Advertisement
noshin98

uva 11530

Jan 8th, 2017
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6.     char a[107];
  7.     int n,s,j,t,i;
  8.     scanf("%d",&t);
  9.     getchar();
  10.     for(i=1;i<=t;i++)
  11.     {
  12.         gets(a);
  13.         s=0;
  14.         n=strlen(a);
  15.             for(j=0;j<n;j++)
  16.             {
  17.             if((a[j]=='a')||(a[j]=='d')||(a[j]=='g')||(a[j]=='j')||(a[j]=='m')||(a[j]=='p')||(a[j]=='t')||(a[j]=='w')||(a[j]==' '))
  18.             s+=1;
  19.                 else if((a[j]=='b')||(a[j]=='e')||(a[j]=='h')||(a[j]=='k')||(a[j]=='n')||(a[j]=='q')||(a[j]=='u')||(a[j]=='x'))
  20.             s+=2;
  21.                     else if((a[j]=='c')||(a[j]=='f')||(a[j]=='i')||(a[j]=='l')||(a[j]=='o')||(a[j]=='r')||(a[j]=='v')||(a[j]=='y'))
  22.             s+=3;
  23.                         else if((a[j]=='s')||(a[j]=='z'))
  24.             s+=4;
  25.         }
  26.         printf("Case #%d: %d\n",i,s);
  27.     }
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement