Submission #88452

#TimeUsernameProblemLanguageResultExecution timeMemory
88452xiaowuc1Imena (COCI16_imena)C++14
50 / 50
2 ms636 KiB
#include <bits/stdc++.h> using namespace std; void solve() { string s; int ret = 0; while(true) { s = ""; cin >> s; if(s.size() == 0) break; bool bad = false; if(s[0] < 'A' || s[0] > 'Z') bad = true; for(int i = 1; i < s.size()-1; i++) { bool letter = s[i] >= 'A' && s[i] <= 'Z'; letter |= s[i] >= 'a' && s[i] <= 'z'; bad |= !letter; } { bool perm = false; perm |= s[s.size()-1] >= 'A' && s[s.size()-1] <= 'Z'; perm |= s[s.size()-1] >= 'a' && s[s.size()-1] <= 'z'; perm |= s[s.size()-1] == '!'; perm |= s[s.size()-1] == '?'; perm |= s[s.size()-1] == '.'; bad |= !perm; } if(!bad) ret++; if(s[s.size()-1] == '.' || s[s.size()-1] == '!' || s[s.size()-1] == '?') { cout << ret << endl; ret = 0; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }

Compilation message (stderr)

imena.cpp: In function 'void solve()':
imena.cpp:14:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < s.size()-1; i++) {
                    ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...