from sys import stdin, stdout n = int(stdin.readline()) tests = stdin.readline().strip() group_size = n // 10 result = 0 for group_idx in range(10): if all([x == "T" for x in tests[group_size * group_idx : group_size * (group_idx+1)]]): result += 1 stdout.write(str(result)+"\n")
1 2 3 4 5 6 7 8 9 10 11 12 | from sys import stdin, stdout n = int(stdin.readline()) tests = stdin.readline().strip() group_size = n // 10 result = 0 for group_idx in range(10): if all([x == "T" for x in tests[group_size * group_idx : group_size * (group_idx+1)]]): result += 1 stdout.write(str(result)+"\n") |