###### tags: `I2P(I)` # 13577 - Anya loves to encrypt > [color=#efbe37] If the solution is ambiguous or hard to understand, please contact me. Thanks. > d0922396206@gmail.com ## Brief Encrypt 5 character string by changing lowercase to uppercase and reversing each alphabet. ## Solution > Follow $ASCII$ $Table$ to encrypt the string. > First, we need to change lowercase to uppercase. By observing $ASCII$ $Table$, the code of lowercase is always 32 larger than the code of uppercase(Ex: a = 97, A = 65) > Later, we need to reverse each alphabet. By observing $ASCII$ $Table$, the sum of alphebet's code and its reversing alphbet's code is 155(Ex: A = 65, Z = 90) > ![](https://imgur.com/cxowg97.png) You can also directly replace `155` with `('A' + 'Z')`, and replace `32` with `('a' - 'A')`, it would be the same result. ![](https://i.imgur.com/kU702RV.png) ## Reference Code ```cpp= #include<stdio.h> int main(void) { int a, b, c, d, e; scanf("%c%c%c%c%c", &a, &b, &c, &d, &e); // a-32 = lowercase -> uppercase; 155-(a-32) = reverse alphabet a = 155 - (a - 32); // you can write this instead. // a = ('A' + 'Z') - (a - ('a' - 'A')); b = 155 - (b - 32); c = 155 - (c - 32); d = 155 - (d - 32); e = 155 - (e - 32); printf("%c%c%c%c%c\n", a, b, c, d, e); return 0; } ```