Used approach:m1 maps all string (prefix,suffix)->no.of time and m2 maps to its length(hash)

eg: string abcd

m1(a,d)->1(no., times) m2(a,d)->1(length)

m1(ab,cd)->1 m2(ab,cd)->1

m1(abc,bcd)->1 …->3

m1(abcd,abcd)->1 …->4

and sort according to length then coming from bottom(descending order) and decreasing no. of times for the removed string which is already considered in some pair(dehash).

Problem - https://www.codechef.com/problems/ENGLISH

**My submission** - https://www.codechef.com/viewsolution/28963265