# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703976 | vjudge1 | Imena (COCI16_imena) | C++11 | 1 ms | 300 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 main() {
int n;
cin >> n;
getchar();
string s;
getline(cin, s);
s += ' ';
int ans = 0, flag = 0, down = 0, b = 1;
for (int j = 0; j < s.size(); ++j) {
char ss = s[j];
if (ss == ' '){
if (flag == 1) ans++, flag = 0;
if (s[j-1] == '.' || s[j-1] == '?' || s[j-1] == '!') {
cout << ans << endl;
ans = 0, flag = 0;
}
}
else if (ss >= 'A' && ss <= 'Z') flag = 1;
else if (!((ss >= 'A' && ss <= 'Z') || (ss >= 'a' && ss <= 'z')) && ss != '.' && ss != '!' && ss != '?' ) flag = 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |