N=int(input())
S=input()
S+=" "
p=0
z=0
for i in range(len(S)):
#print(p)
if i==0 and S[i] in "QWERTZUIOPASDFGHJKLYXCVBNM" or p==0 and S[i] in "QWERTZUIOPASDFGHJKLYXCVBNM" and S[i-1]==" ":
p=1
continue
if p==1 and S[i]==" ":
z+=1
p=0
if p==1 and S[i] in "!?." and S[i+1]==" ":
p=0
print(z+1)
z=0
continue
if p==0 and S[i] in "!?." and S[i+1]==" ":
print(z)
z=0
continue
if p==1 and bool(S[i] in "qwertzuiopasdfghjklyxcvbnm!?.")==0:
p=0
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
3428 KB |
Output is correct |
2 |
Correct |
26 ms |
3300 KB |
Output is correct |
3 |
Correct |
26 ms |
3300 KB |
Output is correct |
4 |
Correct |
26 ms |
3300 KB |
Output is correct |
5 |
Correct |
27 ms |
3300 KB |
Output is correct |
6 |
Correct |
26 ms |
3468 KB |
Output is correct |
7 |
Correct |
25 ms |
3300 KB |
Output is correct |
8 |
Correct |
26 ms |
3364 KB |
Output is correct |
9 |
Correct |
26 ms |
3364 KB |
Output is correct |
10 |
Correct |
27 ms |
3364 KB |
Output is correct |