import sys def chunks(data, n): return [data[i*n:(i+1)*n] for i in range(len(data)//n)] n = int(input()) tests = input() chunksize = n//10 score = 0 for chunk in chunks(tests, chunksize): if all(c == "T" for c in chunk): score += 1 print(score)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import sys def chunks(data, n): return [data[i*n:(i+1)*n] for i in range(len(data)//n)] n = int(input()) tests = input() chunksize = n//10 score = 0 for chunk in chunks(tests, chunksize): if all(c == "T" for c in chunk): score += 1 print(score) |