fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <map>
  4. #include <string>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <cctype>
  8.  
  9. namespace headers {
  10. using namespace std;
  11.  
  12. typedef vector<int> VI;
  13. typedef long long LL;
  14. typedef unsigned long long ULL;
  15.  
  16. #define FOR(x, b, e) for(int x = b; x <= (e); ++x)
  17. #define FORD(x, b, e) for(int x = b; x >= (e); --x)
  18. #define REP(x, n) for(int x = 0; x < (n); ++x)
  19. #define ALL(c) (c).begin(), (c).end()
  20.  
  21. #if defined(_MSC_VER)
  22. #define VAR(v,n) decltype(n) v=(n)
  23. #elif defined(__GNUC__)
  24. #define VAR(v, n) __typeof(n) v = (n)
  25. #define putc putc_unlocked
  26. #define getc getc_unlocked
  27. #endif
  28.  
  29. #define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
  30. #define SIZE(x) ((int)(x).size())
  31. #define PB push_back
  32. #define ST first
  33. #define ND second
  34.  
  35. static inline void read(ULL *n)
  36. {
  37. register char c = 0;
  38. while (c < 48) c = getc(stdin);
  39. (*n) = 0;
  40. while (c > 47) { (*n) = (*n) * 10ULL + (c - '0'); c = getc(stdin); }
  41. }
  42.  
  43. static inline void read(LL *n)
  44. {
  45. register char c = 0;
  46. while (c < 33) c = getc(stdin);
  47. (*n) = 0;
  48.  
  49. if (c == '-') {
  50. c = getc(stdin);
  51. while (c > 32) { (*n) = (*n) * 10LL - (c - '0'); c = getc(stdin); }
  52. }
  53. else
  54. {
  55. while (c > 32) { (*n) = (*n) * 10LL + (c - '0'); c = getc(stdin); }
  56. }
  57. }
  58.  
  59. static inline bool readC(ULL *n)
  60. {
  61. register char c = 0;
  62. while (c < 45) { c = getc(stdin); if (c == EOF || c == '\n') return false; };
  63. (*n) = 0;
  64.  
  65. while (c > 47) { (*n) = (*n) * 10ULL + (c - '0'); c = getc(stdin); }
  66. return true;
  67. }
  68.  
  69. static inline bool readC(LL *n)
  70. {
  71. register char c = 0;
  72. while (c < 45) { c = getc(stdin); if (c == EOF || c == '\n') return false; };
  73. (*n) = 0;
  74.  
  75. if (c == '-') {
  76. c = getc(stdin);
  77. while (c > 47) { (*n) = (*n) * 10LL - (c - '0'); c = getc(stdin); }
  78. }
  79. else
  80. {
  81. while (c > 47) { (*n) = (*n) * 10LL + (c - '0'); c = getc(stdin); }
  82. }
  83. return true;
  84. }
  85.  
  86. static inline void read(unsigned *n)
  87. {
  88. register char c = 0;
  89. while (c < 48) c = getc(stdin);
  90. (*n) = 0;
  91. while (c > 47) { (*n) = (*n) * 10U + (c - '0'); c = getc(stdin); }
  92. }
  93.  
  94. static inline void read(int *n)
  95. {
  96. register char c = 0;
  97. while (c < 33) c = getc(stdin);
  98. (*n) = 0;
  99.  
  100. if (c == '-') {
  101. c = getc(stdin);
  102. while (c > 32) { (*n) = (*n) * 10 - (c - '0'); c = getc(stdin); }
  103. }
  104. else
  105. {
  106. while (c > 32) { (*n) = (*n) * 10 + (c - '0'); c = getc(stdin); }
  107. }
  108. }
  109.  
  110. static inline bool readC(unsigned *n)
  111. {
  112. register char c = 0;
  113. while (c < 45) { c = getc(stdin); if (c == EOF || c == '\n') return false; };
  114. (*n) = 0;
  115.  
  116. while (c > 47) { (*n) = (*n) * 10U + (c - '0'); c = getc(stdin); }
  117. return true;
  118. }
  119.  
  120. static inline bool readC(int *n)
  121. {
  122. register char c = 0;
  123. while (c < 45) { c = getc(stdin); };
  124. (*n) = 0;
  125.  
  126. if (c == '-') {
  127. c = getc(stdin);
  128. while (c > 47) { (*n) = (*n) * 10 - (c - '0'); c = getc(stdin); }
  129. }
  130. else
  131. {
  132. while (c > 47) { (*n) = (*n) * 10 + (c - '0'); c = getc(stdin); }
  133. }
  134.  
  135. if (c == EOF || c == '\n') return false;
  136. return true;
  137. }
  138. }
  139. using namespace headers;
  140.  
  141. int main() {
  142. ios_base::sync_with_stdio(0);
  143.  
  144. char A[] = { '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' };
  145.  
  146. char B[26];
  147.  
  148. for (int i = 0; i < 26; i++)
  149. {
  150. B[A[i] - 'A'] = i + 'A';
  151. }
  152.  
  153. string in;
  154.  
  155. while (getline(cin, in)) {
  156. for (int i = 0; i < in.length(); i++) {
  157. if (in[i] >= 'A' && in[i] <= 'Z') {
  158. printf("%c", B[in[i] - 'A']);
  159. }
  160. else {
  161. printf("%c", in[i]);
  162. }
  163. }
  164. printf("\n");
  165. }
  166.  
  167. return 0;
  168. }
Success #stdin #stdout 0s 2880KB
stdin
QSQ DQ AGZQ
WGSTA O SGSTA
STAEPQ LMNYKGVQFOQ
stdout
ALA MA KOTA
BOLEK I LOLEK
LEKCJA SZYFROWANIA