# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397510 | Alma | Imena (COCI16_imena) | C++17 | 1 ms | 332 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;
bool name (string & s, int m) {
if ('A' <= s[0] && s[0] <= 'Z') {} else return false;
for (int i = 1; i < m; i++) {
if ('a' <= s[i] && s[i] <= 'z') continue;
else if ((s[i] == '.' || s[i] == '?') || s[i] == '!') continue;
else return false;
}
return true;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n, m, sentence = 1, names = 0;
cin >> n;
string s;
while (cin >> s) {
if (sentence > n) break;
int m = (int)s.size();
if (name(s, m)) names++;
if ((s[m-1] == '.' || s[m-1] == '?') || s[m-1] == '!') {
cout << names << '\n';
names = 0; sentence++;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |