#include <iostream> int t; std::string ans; void CountPoints(int test, std::string ans); int main() { std::cin >> t; std::cin >> ans; CountPoints(t, ans); } void CountPoints(int test, std::string ans) { int points = 0; for (int i = 0; i < ans.length() - 1; i+=2) { if (ans[i] == 'T' && ans[i + 1] == 'T') points++; } std::cout << points; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> int t; std::string ans; void CountPoints(int test, std::string ans); int main() { std::cin >> t; std::cin >> ans; CountPoints(t, ans); } void CountPoints(int test, std::string ans) { int points = 0; for (int i = 0; i < ans.length() - 1; i+=2) { if (ans[i] == 'T' && ans[i + 1] == 'T') points++; } std::cout << points; } |