For this Question: Given a string s, your task is to divide the string in as many parts as it is possible such that a character can only be present in at most 1 part.Input contains a single string S.

Constraints:-
1 < = N < = 100000

Note:-
String will contain only lowercase english alphabetsPrint the maximum number of partitions.Sample Input:-
abcdaefghgheklmnol

Sample Output:-
4

Explanation:-
abcda efghghe k lmnol

Sample Input:-
newtonschool

Sample Output:-
2

Explanation:-
newtonschoo l, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		int n=str.length();
		int count=0;
		int t,index;
		for(int i=0;i<n;)
		{
			index=str.lastIndexOf(str.charAt(i));
			++i;
			if(index==i-1)
			{

				++count;
				continue;
			}
			while(i<index)
			{
				t=str.lastIndexOf(str.charAt(i));
				++i;
				if(t==i-1) continue;
				if(t>index) index=t;
			}

			++count;
			i=index+1;
		}
		System.out.print(count);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?