let string s t anagram possible rearrange symbol stre s string equal tLets consider string s t anagram we t reducible anagram s exist integer k ge 2 2k nonempty string s_1 t_1 s_2 t_2 dots s_k t_k satisfy follow condition if write string s_1 s_2 dot s_k order result string equal s if write string t_1 t_2 dots t_k order result string equal t for integer 1 k inclusive s_i t_i anagram if string do not exist t say irreducible anagram s note notion define s t anagram otherFor example consider stre s gamegame then stre t megamage reducible anagram s choose example s_1 game s_2 gam s_3 e t_1 mega t_2 mag t_3 e on hand prove t memegaga irreducible anagram sYou give stre s q query represent integer 1 le l le r le s s equal length string s for query find substre s form character lth rth irreducible anagram