n = int(input()) S = str(input()) k = n//10 odp = 0 for p in range(0, n-k+1, k): ok=True for i in range(p+1, p+k): if S[i-1] != S[i]: ok=False if ok and S[p] == 'T': odp += 1 print(odp)
1 2 3 4 5 6 7 8 9 10 11 12 | n = int(input()) S = str(input()) k = n//10 odp = 0 for p in range(0, n-k+1, k): ok=True for i in range(p+1, p+k): if S[i-1] != S[i]: ok=False if ok and S[p] == 'T': odp += 1 print(odp) |