# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88452 | xiaowuc1 | Imena (COCI16_imena) | C++14 | 2 ms | 636 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |