fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char p[100];
  6. fgets(p, sizeof(p), stdin);
  7. char c[100];
  8. int i = 0;
  9. int k = 8;
  10. int n = strlen(p)-1;
  11. p[n] = 0;
  12. for (i = 0 ; i != n ; i++) {
  13. c[i] = ((p[i] -'a' + k) % 26) + 'a';
  14. }
  15. c[i] = 0;
  16. printf("%s\n", c);
  17. for (i = 0 ; i != n ; i++) {
  18. c[i] = ((p[i] -'a' - k) % 26) + 'a';
  19. }
  20. printf("%s\n", p);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 10320KB
stdin
quick brown fox jumps over the lazy dogc
stdout
ycqks\jzwev\nwf\rcuxa\wdmz\bpm\tihg\lwo
quick brown fox jumps over the lazy dog