My issue
The online compilation is showing different results than GCC. I wrote the solution for this problem and it was showing “Wrong Answer”. I was trying to find the error with my code, and after half an hour I got to know that the answer for the testcase “CODETOWN” is different in my GCC(which was showing it correct btw) and the online IDE on codechef. Can anyone help?
This actually wasted a pretty big chunk of my time and it is not acceptable in contests. If anyone could have a look into this, it would be grateful and appreciated
My code
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
bool isvowel(char ch) {
if ((ch == 'A') || (ch == 'E') ||(ch == 'I') ||(ch == 'O') ||(ch == 'U'))
return 1;
else
return 0;
}
int main()
{
int t;
cin >> t;
for (int i = 0; i < t; ++i) {
char s[8];
cin >> s;
int c = 0;
for (int i = 0; i < 8; ++i) {
if (i == 1 || i == 3 || i == 5) {
if (isvowel(s[i])) {
c++;
}
}
else {
if (isvowel(s[i]) == 0) {
c++;
}
}
}
if (c == 8) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
return 0;
}
Problem Link: Reach Codetown Practice Coding Problem - CodeChef