fork download
#include <stdio.h>
#include<string.h>
int N,u,T,M=0;
int length[100];
int timer;
int main(void) {
scanf("%d",&T);
char input[100][T][20];
u=T;
int o=0;
while(o<T)
{
    scanf("%d",&N);
    timer=0;
while(M<N){
    scanf("%19s",&input[M][o][0]);
        int len=strlen(input[M][o]);
    for(int i=0;i<=(len-1);i++)
    {
       if(input[M][o][i]=='d'||input[M][o][i]=='f')
       {
                 if((input[M][o][i-1]=='d'||input[M][o][i-1]=='f')&&i!=0)
{
    timer=timer+4;
}else if(i==0||input[M][o][i-1]=='j'||input[M][o][i-1]=='k')
{timer=timer+2;}
           
       }
       else if(input[M][o][i]=='j'||input[M][o][i]=='k')
              {
                         if(input[M][o][i-1]=='j'||input[M][o][i-1]=='k')
{
    timer=timer+4;
    
}
              else if(i==0||input[M][o][i-1]=='d'||input[M][o][i-1]=='f') {
                  timer=timer+2;
                  
              }    
                  
              }

    }

    
    
    
    
    M++;
}
printf("%d \n",timer);

    o++;
}







}

Success #stdin #stdout 0s 9424KB
stdin
2
2
dfd
dfd
3
dfd
dfd
dfd
stdout
20 
10