n = int(input()) tests = input() points = 0 group_size = n // 10 count = 0 i = 0 while i < n: if tests[i] == 'T': count += 1 if count == group_size: points += 1 count = 0 i += 1 else: i += (group_size - count) count = 0 print(points)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | n = int(input()) tests = input() points = 0 group_size = n // 10 count = 0 i = 0 while i < n: if tests[i] == 'T': count += 1 if count == group_size: points += 1 count = 0 i += 1 else: i += (group_size - count) count = 0 print(points) |