Code Coach - It's a sign
Input Format Four strings that represent the word or phrase that was supposed to be printed on the signs inside each box. Output Format A string that say 'Open' if at least one of the boxes is a palindrome or 'Trash' if all of the signs are misprinted. So here is my solution for this problem, idk why test case 3 says wrong, so help me maybe ✌🏻 #include <iostream> #include <string> using namespace std; int main() { string arr[4]; string word[] = {"aman", "abba", "bcba","car"}; int c = 0; for (int i = 0; i < 4; i++){ cin>>arr[i]; } for (int i = 0; i < 4; i++){ int x = arr[i].length(); for (int j = 0; j < x; j++){ word[i][j] = arr[i][x - j - 1]; } if (word[i] == arr[i]){ c++; } } //cout<<word[0]; if (c >= 1){ cout<<"Open"; } else cout<<"Trash"; return 0; }