#include <cstdio>
int main(){
int n,i,tst;
int res=0;
bool b=true;
char inp[105];
scanf("%d\n", &n);
scanf("%s",inp);
tst=n/10;
for(i=0;i<n;i++){
tst--;
b=b&&(inp[i]=='T');
if(tst==0){
if(b)res++;
tst=n/10;
b=true;
}
}
printf("%d\n",res);
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <cstdio> int main(){ int n,i,tst; int res=0; bool b=true; char inp[105]; scanf("%d\n", &n); scanf("%s",inp); tst=n/10; for(i=0;i<n;i++){ tst--; b=b&&(inp[i]=='T'); if(tst==0){ if(b)res++; tst=n/10; b=true; } } printf("%d\n",res); return 0; } |
English