#include <iostream> using namespace std; int main() { int n, k=0; string s; cin>>n; cin>>s; for(int i=0; i<n; i+=2) { if((s[i]=='T')&&(s[i+1]=='T')) k++; } cout<<k; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> using namespace std; int main() { int n, k=0; string s; cin>>n; cin>>s; for(int i=0; i<n; i+=2) { if((s[i]=='T')&&(s[i+1]=='T')) k++; } cout<<k; return 0; } |