What's wrong in it?

#include<bits/stdc++.h>
using namespace std;

int main(){
string s;
cin>>s;
for(unsigned long long int i=0;i<s.size();i++){
char c=s.at(i);
int num= c-‘0’;
int nenum = 9-num;
if(nenum<num){
s[i]=(char)(nenum + 48);
}
}
cout<<s<<endl;
return 0;
}

@chetan_aggarwalbX1
999 ans 900 , your ans 000 check it ( you dont have to change first character if its 9)
hope its clear if yes dont forget to hit like and mark resolved :smiley:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like