public int[] solve(String S)
	{
		int[] alphabets = new int[26];
		for(int i=0;i<S.length();i++){
			alphabets[S.charAt(i)-'a']++;
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<alphabets.length;i++){
			char[] alphaChars = new char[alphabets[i]];
			char c = (char)('a'+i); 
			for(int j=0;j<alphabets[i];j++){
				alphaChars[j] = c;
			}
			sb.append(alphaChars);
		}
		String min = sb.toString();
		
		sb = new StringBuilder(S);
		String reverse = sb.reverse().toString();
		
		System.out.println(S);
		System.out.println(min);
		
		if(S.equals(min))
			return new int[]{0,0};
		
		int difIndex = 0;
		while(difIndex < S.length()){
			if(S.charAt(difIndex) != min.charAt(difIndex))
				break;
			difIndex++;
		}
//		System.out.println(difIndex);
		
		char target = min.charAt(difIndex);
		String subReverse = S;
		int x=difIndex;
		int y=-1;
		for(int i=difIndex+1;i<S.length();i++){
			if(S.charAt(i) == target){
				String str = S.substring(0,difIndex) + reverse.substring(S.length()-1-i, S.length()-difIndex) + S.substring(i+1);
				if(subReverse.compareTo(str)>0){
					subReverse = str;
					y = i;
					
				}
			}
		}
//		System.out.println(subReverse);
		
		return new int[]{x,y};
	}