import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static String reverse(String input){ char[] in = input.toCharArray(); int begin=0; int end=in.length-1; char temp; while(end>begin){ temp = in[begin]; in[begin]=in[end]; in[end] = temp; end--; begin++; } return new String(in); } public static String shuffle(String input){ List characters = new ArrayList(); for(char c:input.toCharArray()){ characters.add(c); } StringBuilder output = new StringBuilder(input.length()); while(characters.size()!=0){ int randPicker = (int)(Math.random()*characters.size()); output.append(characters.remove(randPicker)); } return output.toString(); } static int answerQuery(String s,int l, int r) { // Return the answer for this query modulo 1000000007. String sub=s.substring(l-1,r); int count=0; long fact=sub.length(); long k=sub.length(); for(int i=1;i