fork download
  1. /*
  2. // Sample code to perform I/O:
  3. #include <stdio.h>
  4.  
  5. int main(){
  6. int num;
  7. scanf("%d", &num); // Reading input from STDIN
  8. printf("Input number is %d.\n", num); // Writing output to STDOUT
  9. }
  10.  
  11. // Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
  12. */
  13.  
  14. // Write your code here
  15. #include <stdio.h>
  16. #include <string.h>
  17. int main(){
  18. char str[100000],rpl[100000];
  19. int i,n;
  20. scanf("%s", str);
  21. scanf("%d", &n);
  22. int len=strlen(str);
  23. for(i=0;i<len;i++)
  24. {
  25. if( str[i]>='a' && str[i]<='z' || str[i]>='A' && str[i]<='Z')
  26. {
  27. rpl[i]=(str[i]+n)%26;
  28. }
  29. else if(str[i]>='0' && str[i]<='9')
  30. {
  31. rpl[i]=(str[i]+n)%10;
  32. }
  33. else
  34. continue;
  35. }
  36. printf("%s", rpl); // Writing output to STDOUT
  37. }
  38.  
Success #stdin #stdout 0.01s 5280KB
stdin
19 13
stdout