fork download
  1. #include <stdio.h>
  2.  
  3. void cryptogram(char *s, int n)
  4. {
  5. int i;
  6. char w[] = "azAZ09";
  7. while (*s) {
  8. for ( i = 0; i < 6; i += 2) {
  9. if (*s >= w[i] && *s <= w[i + 1]) {
  10. *s = w[i] + (*s - 2 * w[i] + w[i + 1] + n + 1) % (w[i + 1] - w[i] + 1);
  11. }
  12. }
  13. s++;
  14. }
  15. }
  16.  
  17. int main(void)
  18. {
  19. char s[100];
  20. printf("input = ");
  21. scanf("%s", s);
  22. cryptogram(s, 2);
  23. printf("%s\n", s);
  24. cryptogram(s, -2);
  25. printf("%s\n", s);
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 1680KB
stdin
qiwhd8n08*U(8n98n98n8998HUHUI98Y9!@#@%$@(
stdout
input = skyjf0p20*W(0p10p10p0110JWJWK10A1!@#@%$@(
qiwhd8n08*U(8n98n98n8998HUHUI98Y9!@#@%$@(