| Task: | Sanat |
| Sender: | |
| Submission time: | 2015-12-20 15:49:03 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 32 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 32 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.19 s | 32 | details |
Compiler report
input/code.cpp: In function 'std::string classify(std::string&)':
input/code.cpp:35:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(s.size() >= 5 && nVowel >= s.size()) return finnish;
^
input/code.cpp:37:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < s.size()-1; i++){
^Code
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
typedef long long LL;
using namespace std;
string foreign = "zxcbfqw";
string vowel = "aeiuo";
string finnish = "10-4";
string english = "QAQ";
bool is_foreign(char c){
for(char f : foreign) if(c == f) return true;
return false;
}
bool is_vowel(char c){
for(char f : vowel) if(c == f) return true;
return false;
}
string classify(string& s){
LL nForeign = 0;
LL nVowel = 0;
for(char c : s){
if(c > 'z') return finnish;
if(is_foreign(c)) nForeign++;
if(is_vowel(c)) nVowel++;
}
if(nForeign >= 2) return english;
if(s.size() >= 5 && nVowel >= s.size()) return finnish;
for(int i = 0; i < s.size()-1; i++){
if(s[i] == s[i+1]) return finnish;
}
return english;
}
int main(){
LL n; cin >> n;
for(int i = 0; i < n; i++){
string s; cin >> s;
cout << classify(s) << "\n";
}
}
