For this Question: Rohit loves vowels and he likes a string if it contains all the vowels atleast once.
You are given a String S of length N integers. Find minimum length substring of S which contains all vowels atleast once (it may contain other characters too).The first line contains string length and the second line contains the string.

Constraints 
1 <= N <= 100000
String contains lowercase english alphabetsThe output should contain only one integer which is the length of minimum length substring containing all vowels. If no such substring exists print -1.Sample input 1: 
7
aeiddou

Sample output 1:
7

Sample input 2: 
7
daeioud

Sample output 2:
5

Sample input 3: 
7
daeiodd

Sample output 3:
-1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static int nextI(String str,int i)
    {
        char c=str.charAt(i);
        return 0;
    }
    public static boolean vowel(char c)
    {
        if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') return true;
        else return false;
    }
	public static void main (String[] args) throws IOException {

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String str=br.readLine();
        if(n<5)
        {
            System.out.print(-1);
            return;
        }
        int i=0;
        while(i<n && !vowel(str.charAt(i))) ++i;
        if(i==n)
        {
            System.out.print(-1);
            return;
        }
        int min,max;
        int len=n;
        boolean found=false;
        int index,l;
        while(i<n)
        {
            max=-1;
            min=n;
            if(str.charAt(i)!='a')
            {
                index=str.indexOf('a',i+1);
                if(index==-1) break;
                if(index>max) max=index;
                if(index<min) min=index;
            }
            if(str.charAt(i)!='e')
            {
                index=str.indexOf('e',i+1);
                if(index==-1) break;
                if(index>max) max=index;
                if(index<min) min=index;
            }
            if(str.charAt(i)!='i')
            {
                index=str.indexOf('i',i+1);
                if(index==-1) break;
                if(index>max) max=index;
                if(index<min) min=index;
            }
            if(str.charAt(i)!='o')
            {
                index=str.indexOf('o',i+1);
                if(index==-1) break;
                if(index>max) max=index;
                if(index<min) min=index;
            }
            if(str.charAt(i)!='u')
            {
                index=str.indexOf('u',i+1);
                if(index==-1) break;
                if(index>max) max=index;
                if(index<min) min=index;
            }
            l=max-i+1;
            found=true;
            if(l<len) len=l;

            index=str.indexOf(str.charAt(i),i+1);
            if(index==-1) break;
            if(index<min) min=index;
            i=min;
        }

        System.out.print((found)?len:-1);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?