Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int ok=0;
  7. string s,rez,dump;
  8. getline(cin,s);
  9. for(int i=0;i<s.size();i++)
  10. {
  11. if(s[i]=='0' && rez.size()==0)
  12. dump+='0',ok=1;
  13. else
  14. if(s[i]=='0' && rez.size())
  15. rez+='0';
  16. else
  17. if(isdigit(s[i]))
  18. rez+=s[i];
  19. else
  20. if(s[i]!=' ')
  21. dump+=s[i];
  22. }
  23. if(rez==s)
  24. {
  25. cout<<"CORECT";
  26. return 0;
  27. }
  28. if(rez=="" && ok==0)
  29. {
  30. cout<<"NaN";
  31. return 0;
  32. }
  33. if(rez=="")
  34. cout<<0,dump.erase(dump.begin()+dump.rfind('0'));
  35. else
  36. cout<<rez;
  37. cout<<'\n';
  38. for(int i=0;i<dump.size();i++)
  39. cout<<dump[i]<<" ";
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement