514A. Chewbaсca and Number

514A. Chewbaсca and Number

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. string s;
  6. cin>>s;
  7. for(int i=0;i<s.length();i++){
  8. if(i==0 and s[i]=='9')continue;
  9.  
  10. if(s[i]=='5')s[i]='4';
  11. if(s[i]=='6')s[i]='3';
  12. if(s[i]=='7')s[i]='2';
  13. if(s[i]=='8')s[i]='1';
  14. if(s[i]=='9')s[i]='0';
  15. }
  16. cout<<s;
  17.  
  18. return 0;
  19. }


Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

1535A. Fair Playoff

Aptitude test assistant programmer 2018