← Back to List

17288번: 3개만! ↗

Solutions

Python 3
214 B | 214 chars
a=list(map(int,list(input())))
total=0
cnt=1
for i in range(1,len(a)):
    if a[i]-a[i-1] ==1:
        cnt+=1
    else:
        if cnt == 3:
            total+=1
        cnt=1
if cnt == 3:
    total+=1
print(total)