You are viewing a single comment's thread. Return to all comments →
Python
n=int(input()) s=input() c=0 v=0 for ch in s: if ch=='U': c=c+1 else: c=c-1 if c==0 and ch=='U': v=v+1 print(v)
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Valleys
You are viewing a single comment's thread. Return to all comments →
Python