def calculate_points(n, letters): num_of_groups = int(n / 10) points = 0 for i in range(0, n, num_of_groups): if letters[i:i+num_of_groups] == 'T'*num_of_groups: points += 1 return points n = int(input()) letters = input() print(calculate_points(n, letters))
1 2 3 4 5 6 7 8 9 10 11 12 13 | def calculate_points(n, letters): num_of_groups = int(n / 10) points = 0 for i in range(0, n, num_of_groups): if letters[i:i+num_of_groups] == 'T'*num_of_groups: points += 1 return points n = int(input()) letters = input() print(calculate_points(n, letters)) |