My issue
My code
why this is not getting accepted what’s wrong in this code?
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int g;
cin>>g;
for(int i=0;i<g;i++){
int n;
cin>>n;
string a,b,c;
cin>>a;
cin>>b;
cin>>c;
int a1=a[0];
int b1=b[0];
int k;
// if(a1<=b1)
k=(b[n-1]-a[n-1])%26;
// else k='z'-a[0]+b[0];
// cout<<k;
char p;
for(int j=0;j<n;j++){
int f=c[j];
int r=f+k;
if(r>122){
r=r-122;
p=96+r;
// cout<<char(f);
}
else p=r;
// cout<<p;
// cout<<char(r);
/* char p=r;*/
cout<<p;
}
cout<<endl;
}
return 0;
}
Problem Link: https://www.codechef.com/problems/CAESAR