fork(1) download
  1. #include <bits/stdc++.h>
  2. int main() {
  3. int T,n;
  4. scanf("%d",&T);
  5. while(T-->0)
  6. {
  7. int i=0;
  8. char s[100005];
  9. char res[10005]="";
  10. scanf(" %[^\n]s",s);
  11. scanf("%d",&n);
  12. if(n>26)
  13. n=n%26;
  14. n=n%26;
  15. int L = strlen(s);
  16. for(i=0;i<L;i++)
  17. {
  18. if(isalpha(s[i]))
  19. {
  20. s[i] = s[i]- n;
  21. if(islower(s[i])&&s[i]<'a' || isupper(s[i])&&s[i]<'A' )
  22. {
  23. s[i]=s[i]-n+26;
  24. }
  25. }
  26. else
  27. continue;
  28. }
  29. printf("%s\n",s);
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 3464KB
stdin
2
ofyvt
1
Aqw eqwnf jcxg uvwfkgf gctnkgt!
28
stdout
nexus
?ou could have studied earlier!