Advertisement
Pabon_SEC

One-Handed Typist

Apr 6th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. char str[]  = "`1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:ZXCVBNM<> ";
  6.  
  7. char str1[] = "`123qjlmfp/[]456.orsuyb;=789aehtdck-0zx,inwvg'~!@#QJLMFP?{}$%^>ORSUYB:+|&*(AEHTDCK)ZX<INWVG ";
  8.  
  9. int ascii[260];
  10.  
  11. char input[1002];
  12.  
  13. void init(int len)
  14. {
  15.     int i;
  16.  
  17.     for(i=0;i<len;i++)
  18.     {
  19.         ascii[str[i]] = str1[i];
  20.     }
  21. }
  22.  
  23. int main()
  24. {
  25.     int len = strlen(str),i,a;
  26.  
  27.     char ch = '"';
  28.  
  29.     init(len);
  30.  
  31.     while(gets(input))
  32.     {
  33.         len = strlen(input);
  34.  
  35.         for(i=0;i<len;i++)
  36.         {
  37.             if(input[i]=='\\')
  38.             {
  39.                 printf("\\");
  40.             }
  41.             else if(input[i]=='"')
  42.             {
  43.                 printf("_");
  44.             }
  45.             else if(input[i]=='?')
  46.             {
  47.                 printf("%c",ch);
  48.             }
  49.             else
  50.             {
  51.                 printf("%c",ascii[input[i]]);
  52.             }
  53.         }
  54.  
  55.         printf("\n");
  56.     }
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement