n = int(input()) results = input() cnt = 0 group = n / 10 correct_tests = 0 answer = 0 for i in range(n): cnt += 1 if results[i] == 'T': correct_tests += 1 if cnt == group: if correct_tests == group: answer += 1 cnt = 0 correct_tests = 0 print(answer)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | n = int(input()) results = input() cnt = 0 group = n / 10 correct_tests = 0 answer = 0 for i in range(n): cnt += 1 if results[i] == 'T': correct_tests += 1 if cnt == group: if correct_tests == group: answer += 1 cnt = 0 correct_tests = 0 print(answer) |