fork(1) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <set>
  9. #include <map>
  10. #include <queue>
  11. #include <stack>
  12. #include <list>
  13. #include <cmath>
  14. #include <iomanip>
  15. #define dibs reserve
  16. #define OVER9000 1234567890
  17. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  18. #define tisic 47
  19. #define soclose 1e-8
  20. #define chocolate win
  21. // so much chocolate
  22. #define patkan 9
  23. #define ff first
  24. #define ss second
  25. #define abs(x) ((x < 0)?-(x):x)
  26. #define uint unsigned int
  27. #define dbl long double
  28. using namespace std;
  29. // mylittledoge
  30.  
  31. int main() {
  32. cin.sync_with_stdio(0);
  33. cin.tie(0);
  34. string s[] ={"","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  35. int P[9];
  36. for(int i =0; i < 9; i++) {cin >> P[i]; P[i]--;}
  37. string t;
  38. cin >> t;
  39. string ans;
  40. for(int i =0; i < t.length(); i++) for(int j =0; j < 9; j++)
  41. for(int k =0; k < s[P[j]].length(); k++) if(s[P[j]][k] == t[i]) {
  42. if(ans.length() > 0 && ans[ans.length()-1] == j+'1') ans +='#';
  43. for(int a =0; a <= k; a++) ans +=('1'+j);}
  44.  
  45. cout << ans << "\n";
  46. return 0;}
  47.  
  48. // look at my code
  49. // my code is amazing
Success #stdin #stdout 0s 3480KB
stdin
2 3 4 5 6 7 8 9 1
klor
stdout
44#444555666