Advertisement
daskalot

Untitled

Oct 28th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define pb push_back
  3. #define mp make_pair
  4. #define INF (1 << 27)
  5. #define EPS 0.00000000001
  6. using namespace std;
  7. string in;
  8. int len;
  9. bool checkLex(string temp){
  10. return temp<in;
  11. }
  12. int main(){
  13. cin >> in;
  14. len = in.length();
  15. string tempStr = in;
  16. int found = 0;
  17. for(int i=0;i<=len;i++){
  18. reverse(tempStr.begin(),tempStr.begin()+i);
  19. if(checkLex(tempStr)){
  20. found = i;
  21. }
  22. }
  23. if(found){
  24. for(int j=0;j<len;j++){
  25. if(j<found && j!=0)
  26. cout<<1<<" ";
  27. else
  28. cout<<0<<" ";
  29.  
  30. }
  31. }
  32. else{
  33. for(int j=0;j<len;j++){
  34. if(j==0 || j==len-1)
  35. cout<<1<<" ";
  36. else
  37. cout<<0<<" ";
  38.  
  39. }
  40. }
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement