import sys def _debug(*args): print(*args, file=sys.stderr) def solve(input: str) -> int: score = 0 group_size = len(input) // 10 groups = (input[i:i+group_size] for i in range(0, len(input), group_size)) for group in groups: if group.count('T') == len(group): score += 1 return score def main(): n = int(sys.stdin.readline().strip()) input = sys.stdin.readline(n) result = solve(input) sys.stdout.write(str(result)) if __name__ == '__main__': main()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import sys def _debug(*args): print(*args, file=sys.stderr) def solve(input: str) -> int: score = 0 group_size = len(input) // 10 groups = (input[i:i+group_size] for i in range(0, len(input), group_size)) for group in groups: if group.count('T') == len(group): score += 1 return score def main(): n = int(sys.stdin.readline().strip()) input = sys.stdin.readline(n) result = solve(input) sys.stdout.write(str(result)) if __name__ == '__main__': main() |