fork download
  1. #include <stdio.h>
  2. #include<string.h>
  3. int N,u,T,M=0;
  4. int length[100];
  5. int timer;
  6. int main(void) {
  7. scanf("%d",&T);
  8. char input[100][T][20];
  9. u=T;
  10. int o=0;
  11. while(o<T)
  12. {
  13. scanf("%d",&N);
  14. timer=0;
  15. while(M<N){
  16. scanf("%19s",&input[M][o][0]);
  17. int len=strlen(input[M][o]);
  18. for(int i=0;i<=(len-1);i++)
  19. {
  20. if(input[M][o][i]=='d'||input[M][o][i]=='f')
  21. {
  22. if((input[M][o][i-1]=='d'||input[M][o][i-1]=='f')&&i!=0)
  23. {
  24. timer=timer+4;
  25. }else if(i==0||input[M][o][i-1]=='j'||input[M][o][i-1]=='k')
  26. {timer=timer+2;}
  27.  
  28. }
  29. else if(input[M][o][i]=='j'||input[M][o][i]=='k')
  30. {
  31. if(input[M][o][i-1]=='j'||input[M][o][i-1]=='k')
  32. {
  33. timer=timer+4;
  34.  
  35. }
  36. else if(i==0||input[M][o][i-1]=='d'||input[M][o][i-1]=='f') {
  37. timer=timer+2;
  38.  
  39. }
  40.  
  41. }
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48.  
  49. M++;
  50. }
  51. printf("%d \n",timer);
  52.  
  53. o++;
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. }
  63.  
  64.  
Success #stdin #stdout 0s 9424KB
stdin
2
2
dfd
dfd
3
dfd
dfd
dfd
stdout
20 
10