XJOI恺撒加密术,错哪了?

用代码块功能插入代码,请勿粘贴截图
c++
#include
using namespace std;
char a[10005];
int main(){
int n;
cin >> a >> n;
n = n % 26;
for(int i = 0; a[i] != '\0'; i++){
a[i] = a[i] + n;
if(!(a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z')){
a[i] = a[i] - 26;
}
}
cout << a;
return 0;
}

运行结果及报错内容

compiled successfully
time: 19ms, memory: 364kb, score: 30, status: Wrong Answer

test 1: time: 2ms, memory: 364kb, points: 0, status: Wrong Answer
test 2: time: 1ms, memory: 364kb, points: 0, status: Wrong Answer
test 3: time: 2ms, memory: 364kb, points: 0, status: Wrong Answer
test 4: time: 2ms, memory: 364kb, points: 10, status: Accepted
test 5: time: 3ms, memory: 364kb, points: 0, status: Wrong Answer
test 6: time: 0ms, memory: 364kb, points: 0, status: Wrong Answer
test 7: time: 2ms, memory: 364kb, points: 0, status: Wrong Answer
test 8: time: 2ms, memory: 364kb, points: 10, status: Accepted
test 9: time: 3ms, memory: 364kb, points: 0, status: Wrong Answer
test 10: time: 2ms, memory: 364kb, points: 10, status: Accepted