#include
using namespace std;
int main() {
char a[50];
cin>>a;
int i=0;
if(a[i]==9)
i++;
int d;
for(; a[i]!=’\0’; i++)
{
d = a[i] - ‘0’;
if(d>=5){
d=9-d;
a[i] = d + ‘0’;
}
}
cout<<a<<endl;
return 0;
}
Two of the test cases are not passing
@igarg145
Since you are taking the input in char, you will to compare a[i] with ‘9’
if (a[i] == ‘9’)
i++;