Chewbacca and number ,below code only passes 3 test cases

#include
using namespace std;
int main() {
char a[50];
cin>>a;
int i=0;
if(a[i]==9){
i++;
}
//iterate over the remaing character
for( ;a[i]!=’\0’;i++){
int digit=a[i]-‘0’;
if(digit>=5){
digit=9-digit;
a[i]=digit+‘0’;
}

}
cout<<a;
return 0;

}

I have edited your code…Try to submit now…