# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
703976 | 2023-03-01T07:54:36 Z | vjudge1 | Imena (COCI16_imena) | C++11 | 1 ms | 300 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 296 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 296 KB | Output is correct |
8 | Correct | 0 ms | 300 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |