1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <bits/stdc++.h>

char c[1000];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", c+1);

  int step = n/10;

  for (int i = 1; i <= n; i++) {
    if (c[i] == 'T') c[i] = 1;
    else c[i] = 0;
    c[i] += c[i-1];
  }

  int result = 0;
  for (int i = step; i <= n; i += step) {
    if (c[i] - c[i-step] == step) result ++;
  }
  printf("%d\n", result);

  return 0;
}