Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- #define INF (1 << 27)
- #define EPS 0.00000000001
- using namespace std;
- string in;
- int len;
- bool checkLex(string temp){
- return temp<in;
- }
- int main(){
- cin >> in;
- len = in.length();
- string tempStr = in;
- int found = 0;
- for(int i=0;i<=len;i++){
- reverse(tempStr.begin(),tempStr.begin()+i);
- if(checkLex(tempStr)){
- found = i;
- }
- }
- if(found){
- for(int j=0;j<len;j++){
- if(j<found && j!=0)
- cout<<1<<" ";
- else
- cout<<0<<" ";
- }
- }
- else{
- for(int j=0;j<len;j++){
- if(j==0 || j==len-1)
- cout<<1<<" ";
- else
- cout<<0<<" ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement