-
Notifications
You must be signed in to change notification settings - Fork 0
/
UVA 10921.cpp
34 lines (34 loc) · 981 Bytes
/
UVA 10921.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<stdio.h>
#include<string.h>
int main()
{
int i,len;
char c[50];
while(gets(c))
{
len=strlen(c);
for(i=0; i<len; i++)
{
if(c[i]=='A'||c[i]=='B'||c[i]=='C')
printf("2");
else if(c[i]=='D'||c[i]=='E'||c[i]=='F')
printf("3");
else if(c[i]=='G'||c[i]=='H'||c[i]=='I')
printf("4");
else if(c[i]=='J'||c[i]=='K'||c[i]=='L')
printf("5");
else if(c[i]=='M'||c[i]=='N'||c[i]=='O')
printf("6");
else if(c[i]=='P'||c[i]=='Q'||c[i]=='R'||c[i]=='S')
printf("7");
else if(c[i]=='T'||c[i]=='U'||c[i]=='V')
printf("8");
else if(c[i]=='W'||c[i]=='X'||c[i]=='Y'||c[i]=='Z')
printf("9");
else
printf("%c",c[i]);
}
printf("\n");
}
return 0;
}