erfanul007

UVa 10921

Apr 14th, 2021
574
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     char s[40];
  6.     while(scanf("%s",&s)!=EOF){
  7.         int i,n=strlen(s);
  8.         for(i=0;i<n;i++){
  9.             if(s[i]=='A'||s[i]=='B'||s[i]=='C')
  10.                 printf("2");
  11.             else if(s[i]=='D'||s[i]=='E'||s[i]=='F')
  12.                 printf("3");
  13.             else if(s[i]=='G'||s[i]=='H'||s[i]=='I')
  14.                 printf("4");
  15.             else if(s[i]=='J'||s[i]=='K'||s[i]=='L')
  16.                 printf("5");
  17.             else if(s[i]=='M'||s[i]=='N'||s[i]=='O')
  18.                 printf("6");
  19.             else if(s[i]=='P'||s[i]=='Q'||s[i]=='R'||s[i]=='S')
  20.                 printf("7");
  21.             else if(s[i]=='T'||s[i]=='U'||s[i]=='V')
  22.                 printf("8");
  23.             else if(s[i]=='W'||s[i]=='X'||s[i]=='Y'||s[i]=='Z')
  24.                 printf("9");
  25.             else
  26.                 printf("%c",s[i]);
  27.         }
  28.         printf("\n");
  29.     }
  30.     return 0;
  31. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×