Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prog.c - id=11720103 - time::1402157189433 - WRONG ANSWER
- #include <stdio.h>
- #include <string.h>
- int main(){
- char c =' ';
- while(c!='\n'){
- scanf("%c",&c);
- if(c=='A' || c=='B' || c=='C')
- c='2';
- else if(c=='D' || c=='E' || c=='F')
- c='3';
- else if(c=='G' || c=='H' || c=='I')
- c='4';
- else if(c=='J' || c=='K' || c=='L')
- c='5';
- else if(c=='M' || c=='N' || c=='O')
- c='6';
- else if(c=='p' || c=='Q' || c=='R' || c=='S')
- c='7';
- else if(c=='T' || c=='U' || c=='V')
- c='8';
- else if(c=='X' || c=='W' || c=='Y' || c=='Z')
- c='9';
- printf("%c",c);
- }
- return 0;
- } /* */
- prog.c - id=11720152 - time::1402157249841 - ACCEPTED
- #include <stdio.h>
- #include <ctype.h>
- int main() {
- char ch;
- int dig;
- while ((ch = getc(stdin)) != EOF) {
- if (isalpha(ch)) {
- if (ch >= 'Q') {
- ch--;
- }
- dig = (ch - 'A') / 3;
- putc('2' + dig, stdout);
- } else {
- putc(ch, stdout);
- }
- }
- return 0;
- } /* */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement