Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(){
- int tc, n;
- char in[1001];
- scanf("%d",&tc);
- for(int i=1;i<=tc;i++){
- scanf("%d",&n);
- getchar();
- scanf("%[^\n]",in);
- for(int j=0;j<strlen(in);j++){
- if(in[j]>64 && in[j]<91){
- if(in[j]+n>90){
- in[j]=65+((n-(91-in[j]))%26);
- }else{
- in[j]+=n;
- }
- }
- if(in[j]>96 && in[j]<123){
- if(in[j]+n>122){
- in[j]=97+((n-(123-in[j]))%26);
- }else{
- in[j]+=n;
- }
- }
- }
- printf("Case #%d: ",i);
- for(int j=0;j<strlen(in);j++){
- printf("%c",in[j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement