Task: | Sanat |
Sender: | |
Submission time: | 2015-12-21 10:33:00 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'bool ien(std::string)': input/code.cpp:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<s.size(); ++i)++z[s[i]]; ^ input/code.cpp:19:41: warning: array subscript has type 'char' [-Wchar-subscripts] for (int i=0; i<s.size(); ++i)++z[s[i]]; ^ input/code.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=1; i<s.size(); ++i){ ^ input/code.cpp:24:15: error: invalid types 'char[int]' for array subscript char s=s[i]; ^
Code
#include <iostream> #include <vector> using namespace std; int n; int z[255]; bool vw(char c){ return c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='y'; } bool ien(string s){ if (!vw(s[0]) && !vw(s[1])) return 1; if (!vw(s[s.size()-1])) return 1; for (int i='a'; i<='z'; ++i) z[i]=0; for (int i=0; i<s.size(); ++i)++z[s[i]]; if (z['c'] || z['q'] || z['w'] || z['x'] || z['z']) return 1; for (int i=1; i<s.size(); ++i){ char f=s[i-1]; char s=s[i]; if (i && f==s) return 0; if (!vw(f) && (s=='h' || s=='l')) return 1; } if (z['b'] || z['d'] || z['f'] || z['g']) return 1; if (z['y'] && (z['a'] || z['o'] || z['u'])) return 1; char kv=s[s.size()-3]; if (s[s.size()-1]=='e' && (kv=='u' || kv=='i')) return 1; return 0; } int main(){ cin >> n; for (int i=0; i<n; ++i){ string s; cin >> s; if (ien(s)) cout << "QAQ\n"; else cout << "10-4\n"; } }