I am still getting wrong answer

#include
#include
using namespace std;
int main() {
char ch[20];
int a[20],flag=0,count=0;
cin>>ch;
int n=strlen(ch);
for(int i=0;i<n;i++)
{
if(ch[i]==‘9’)
count++;
if(ch[i]-‘0’>‘9’-ch[i])
a[i]=‘9’-ch[i];
else
a[i]=ch[i]-‘0’;
}
if(count==n)
{
for(int i=0;i<n;i++)
cout<<9;
}
else{
for(int i=0;i<n;i++)
{
if(a[i]!=0)
flag=1;
if(a[i]==0 && flag==0)
continue;
else
cout<<a[i];
}}
return 0;
}

Please save your code on ide.codingblocks.com and then share its link.