1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::string;

int main() {
    size_t n;
    size_t group_cnt = 0;
    size_t result_cnt = 0;
    string results;
    cin >> n;
    cin >> results;
    size_t const GROUP_SIZE = n / 10;
    size_t k = 0;
    while (k < n) {
        if (results[k] == 'T') {
            ++group_cnt;
            ++k;
            if (k % GROUP_SIZE == 0) {
                ++result_cnt;
                group_cnt = 0;
            }
        } else if (results[k] == 'N') {
            k += GROUP_SIZE - group_cnt;
            group_cnt = 0;
        }
    }
    cout << result_cnt;
    return 0;
}