mhdew

UVA 10082

Mar 26th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. //special cases 39 92 49 space
  6.  
  7. int main()
  8. {
  9.     freopen("in.txt", "r", stdin);
  10.     int b[46]={'1','2','3','4','5','6','7','8','9','0','-','=','Q','W','E','R','T','Y','U','I','O','P','[',']','A','S','D','F','G','H','J','K','L',';','Z','X','C','V','B','N','M',',','.','/'};
  11.     char a[100000];
  12.     while(scanf("%[^\n]%*c", a)!=EOF){
  13.         int x;
  14.         for(int i=0;a[i]!='\0';i++){
  15.             x=a[i];
  16.             if(x==39){
  17.                 printf(";");
  18.                 continue;
  19.             }
  20.             if(x==49){
  21.                 printf("`");
  22.                 continue;
  23.             }
  24.             if(x==92){
  25.                 printf("]");
  26.                 continue;
  27.             }
  28.             if(a[i]==' '){
  29.                 printf(" ");
  30.                 continue;
  31.             }
  32.             for(int j=0;j<46;j++){
  33.                 if(a[i]==b[j])
  34.                     printf("%c", b[j-1]);
  35.             }
  36.         }
  37.         printf("\n");
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment