# with open("test.in") as file: # file = file.readlines() # n = int(file[0].strip()) # wyn = file[1].strip() n = int(input()) wyn = input() ileTestow = n // 10 s = 0 i = 0 wzor = "T"*ileTestow while i < n: if wyn[i:i+ileTestow] == wzor: s+=1 i += ileTestow print(s)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # with open("test.in") as file: # file = file.readlines() # n = int(file[0].strip()) # wyn = file[1].strip() n = int(input()) wyn = input() ileTestow = n // 10 s = 0 i = 0 wzor = "T"*ileTestow while i < n: if wyn[i:i+ileTestow] == wzor: s+=1 i += ileTestow print(s) |