fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void shifrator(char * s) {
  5. for (int i = 0; i < strlen(s); ++i) {
  6. s[i] = s[i] / 2;
  7. }
  8. }
  9.  
  10. void deshifrator(char * s) {
  11. for (int i = 0; i < strlen(s); ++i) {
  12. s[i] = s[i] * 2;
  13. if ((unsigned char)s[i]>>6!=3) s[i]--; // ugly hack for UTF-8
  14. }
  15. }
  16.  
  17. int main() {
  18. char stroka[255] = "БЕЗУСЫЙ";
  19. shifrator(stroka);
  20. deshifrator(stroka);
  21. printf("%s\n", stroka);
  22. return 0;
  23. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
БЕЗУСЫЙ