For this Question: Given an integer N and a string S of length (N-1) containing only characters '0' and '1'. Find an array Arr which contains N integers, such that:
> All the values of the array are distinct
> Maximum value of the array can be N
> For i from 1 to N-1 
 if S[i] == '0'
 Arr[i] > Arr[i+1]
 if S[i] == '1'
 Arr[i] < Arr[i+1]
> Arr is lexographically maximum possible

Note:- It can be proven that it will always be possible to create an array Arr satisfying above conditions.First line of input contains a single integer N.
Second line of input contains the string S of length N-1.

Constraints
2 <= N <= 100000
|S| = (N-1)
S contains characters '0' and '1' only.Print N space separated integers, denoting the array Arr.Sample Input 1
5
0001

Sample Output 1
5 4 3 1 2

Explanation
as S[1] == 0, A[1] > A[2]
as S[2] == 0, A[2] > A[3]
as S[3] == 0, A[3] > A[4]
as S[4] == 1, A[4] < A[5]
this is lexographically maximum array possible.

Sample Input 2
6
11100
Sample Output 2
3 4 5 6 2 1, I have written this Solution Code: import java.io.*;
        import java.io.IOException;
    import java.math.BigInteger;
    import java.util.*;













        public  class Main {


                public static long mod = 1000000007 ;
                public static double epsilon=0.00000000008854;
                public static InputReader sc = new InputReader(System.in);
                public static PrintWriter pw = new PrintWriter(System.out);

                public static long pow(long x,long y,long mod){
                    long ans=1;

                    x%=mod;
                    while(y>0){
                        if((y&1)==1){
                            ans=(ans*x)%mod;
                        }
                        y=y>>1;
                        x=(x*x)%mod;
                    }
                    return ans;
                }

                public static void main(String[] args) throws Exception {

                    int n=sc.nextInt();
                    char s[]=sc.nextLine().toCharArray();
                    int i=0,j=0;int max=n,c=0;
                    int f[]=new int[n];int a[]=new int[n];
                    for(i=0;i<n;i++){f[i]=0;a[i]=0;}
                    for(i=0;i<n;i++){
                        if(i<n-1&&s[i]=='0'){
                            a[i]=max;
                            f[max-1]=1;
                            max-=(c+1);
                            if(c!=0){
                                for(j=i-1;j>=i-c;j--){
                                    a[j]=a[j+1]-1;
                                    f[a[j+1]-2]=1;
                                }
                            }
                            c=0;
                        }
                        else c++;
                    }
                    if(c!=0){
                    for(i=n-1;i>=0;i--){
                        if(f[i]==0)break;
                    }
                    i++;
                    a[n-1]=i;
                    for(j=n-2;j>=n-c;j--){
                        a[j]=a[j+1]-1;
                    }
                    }
                    for( i=0;i<n;i++){
                        pw.print(a[i]+" ");
                    }
                    pw.print("\n");





                    pw.flush();
                    pw.close();
                }
                public static Comparator<Integer[]> MOquery(int block){
                    return
                    new Comparator<Integer[]>(){
                        @Override
                        public int compare(Integer a[],Integer b[]){
                            int a1=a[0]/block;
                            int b1=b[0]/block;
                            if(a1==b1){
                                if((a1&1)==1)
                                return a[1].compareTo(b[1]);
                                else{
                                    return b[1].compareTo(a[1]);
                                }
                            }
                            return a1-b1;
                        }
                    };
                }

                public static Comparator<Long[]> column(int i){
                    return
                    new Comparator<Long[]>() {
                        @Override
                        public int compare(Long[] o1, Long[] o2) {
                            return o1[i].compareTo(o2[i]);

                        }
                    };
                }
                public static Comparator<Integer[]> column(){
                    return
                    new Comparator<Integer[]>() {
                        @Override
                        public int compare(Integer[] o1, Integer[] o2) {


                            long a1=o1[0];
                            long a2=o2[1];
                            long b1=o2[0];
                            long b2=o1[1];
                            int ans=0;
                            if(a1*a2>b1*b2){
                                ans=1;
                            }
                            else ans=-1;
                            return ans;
                        }
                    };
                }
                public static Comparator<Integer[]> col(int i){
                    return
                    new Comparator<Integer[]>() {
                        @Override
                        public int compare(Integer[] o1, Integer[] o2) {
                            if(o1[i]-o2[i]!=0)
                            return o1[i].compareTo(o2[i]);
                            return o1[i+1].compareTo(o2[i+1]);

                        }
                    };
                }
                public static Comparator<Integer> des(){
                    return
                    new Comparator<Integer>() {
                        @Override
                        public int compare(Integer o1, Integer o2) {

                            return o2.compareTo(o1);
                        }
                    };
                }




                public static String reverseString(String s){
                    StringBuilder input1 = new StringBuilder();
                    input1.append(s);
                    input1 = input1.reverse();
                    return input1.toString();
                }
                public static int[] scanArray(int n){
                    int a[]=new int [n];

                    for(int i=0;i<n;i++){
                        a[i]=sc.nextInt();
                    }


                    return a;
                }
                public static long[] scanLongArray(int n){
                    long a[]=new long [n];
                    for(int i=0;i<n;i++)
                    a[i]=sc.nextLong();

                    return a;
                }
                public static String [] scanStrings(int n){
                    String a[]=new String [n];
                    for(int i=0;i<n;i++)
                    a[i]=sc.nextLine();

                    return a;
                }
                public static class InputReader {

                    private final InputStream stream;
                    private final byte[] buf = new byte[8192];
                    private int curChar, snumChars;
                    private SpaceCharFilter filter;

                    public InputReader(InputStream stream) {
                        this.stream = stream;
                    }

                    public int snext() {
                        if (snumChars == -1)
                            throw new InputMismatchException();
                        if (curChar >= snumChars) {
                            curChar = 0;
                            try {
                                snumChars = stream.read(buf);
                            } catch (IOException e) {
                                throw new InputMismatchException();
                            }
                            if (snumChars <= 0)
                                return -1;
                        }
                        return buf[curChar++];
                    }

                    public int nextInt() {
                        int c = snext();
                        while (isSpaceChar(c)) {
                            c = snext();
                        }
                        int sgn = 1;
                        if (c == '-') {
                            sgn = -1;
                            c = snext();
                        }
                        int res = 0;
                        do {
                            if (c < '0' || c > '9')
                                throw new InputMismatchException();
                            res *= 10;
                            res += c - '0';
                            c = snext();
                        } while (!isSpaceChar(c));
                        return res * sgn;
                    }

                    public long nextLong() {
                        int c = snext();
                        while (isSpaceChar(c)) {
                            c = snext();
                        }
                        int sgn = 1;
                        if (c == '-') {
                            sgn = -1;
                            c = snext();
                        }
                        long res = 0;
                        do {
                            if (c < '0' || c > '9')
                                throw new InputMismatchException();
                            res *= 10;
                            res += c - '0';
                            c = snext();
                        } while (!isSpaceChar(c));
                        return res * sgn;
                    }

                    public int[] nextIntArray(int n) {
                        int a[] = new int[n];
                        for (int i = 0; i < n; i++) {
                            a[i] = nextInt();
                        }
                        return a;
                    }

                    public String readString() {
                        int c = snext();
                        while (isSpaceChar(c)) {
                            c = snext();
                        }
                        StringBuilder res = new StringBuilder();
                        do {
                            res.appendCodePoint(c);
                            c = snext();
                        } while (!isSpaceChar(c));
                        return res.toString();
                    }

                    public String nextLine() {
                        int c = snext();
                        while (isSpaceChar(c))
                            c = snext();
                        StringBuilder res = new StringBuilder();
                        do {
                            res.appendCodePoint(c);
                            c = snext();
                        } while (!isEndOfLine(c));
                        return res.toString();
                    }

                    public boolean isSpaceChar(int c) {
                        if (filter != null)
                            return filter.isSpaceChar(c);
                        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
                    }

                    private boolean isEndOfLine(int c) {
                        return c == '\n' || c == '\r' || c == -1;
                    }

                    public interface SpaceCharFilter {
                        public boolean isSpaceChar(int ch);
                    }
                }

            }, In this Programming Language: Java, Now tell me if this Code is compilable or not?