n = int(input()) cmd = input() def mp4(number, commands): c = 1 l = [1,2,3,4] for i in cmd: if i == 'U': c -= 1 if c not in l and l[0] == 1: l = [n-3,n-2,n-1,n] c = n elif c not in l and l[0] != 1: ...