#include <bits/stdc++.h>
using namespace std;
int nn;
int main()
{
cin >> nn;
int q = 0;
int ans = 0;
while (1)
{
int n;
string a;
cin >> a;
n = a.size();
bool z = true;
if (!('A' <= a[0] && a[0] <= 'Z'))
z = false;
for (int i = 1; i < n; ++i)
{
if (a[n - 1] == '.' || a[n - 1] == '?' || a[n - 1] == '!')
continue;
if (!('a' <= a[i] && a[i] <= 'z'))
z = false;
}
if (z)
++ans;
if (a[n - 1] == '.' || a[n - 1] == '?' || a[n - 1] == '!')
{
cout << ans << endl;
++q;
ans = 0;
if (q == nn)
break;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |