1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

int main(){
    ios_base :: sync_with_stdio(0);
    int n; cin >> n;
    string s; cin >> s;
    int sum = 0,res = 0;
    for(int i = 0; i < n; i++){
        sum += (s[i] == 'T') - (s[i] == 'N');
        if((i + 1) % (n / 10) == 0){
            if(sum == n / 10)
                res++;
            sum = 0;
        }
    }cout << res << endl;
}