Chewbacca and number I am not able to understand where it’s failing.
#include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin>>s;
int i=0;
while(i<s.length())
{
if(s[i]==‘9’)
i++;
else
break;
}
for(int j=i;j<s.length();j++)
{
int p=s[j]-‘0’;
int q=9-(s[j]-‘0’);
s[j]=min(p,q)+‘0’;
}
cout<<s;
}