#include
using namespace std;
int main() {
char a[50];
cin>>a;
for(int i=0; a[i]!=’\0’; i++) {
if(a[0]==9) {
i++;
}
int digit = a[i]-‘0’; //convert char to int
if(digit >= 5) {
digit = 9-digit;
a[i] = digit + ‘0’;
}
else if(digit < 5) {
a[i] = digit+‘0’;
}
}
cout<<a;
return 0;
}
Out of 5, only 3 test cases are getting passed. Whats the error?