Submission #161847

#TimeUsernameProblemLanguageResultExecution timeMemory
161847boolodifjenulaImena (COCI16_imena)Cpython 3
50 / 50
27 ms3468 KiB
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 timeMemoryGrader output
Fetching results...