# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238305 | marlicu | Imena (COCI16_imena) | C++14 | 5 ms | 384 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;
int ime(string s) {
if (s[0] < 'A' || s[0] > 'Z') return 0;
for (int i = 1; i < s.size(); i++) {
if (s[i] < 'a' || s[i] > 'z') return 0;
}
return 1;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
string n, s;
getline(cin, n);
getline(cin, s);
int imena = 0;
string rijec;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '.' || s[i] == '?' || s[i] == '!') {
if (ime(rijec)) imena++;
cout << imena << '\n';
imena = 0;
rijec = "";
}
else if (s[i] == ' ') {
if (ime(rijec)) imena++;
rijec = "";
}
else rijec += s[i];
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |