Anyone has an idea how to solve it ?

The problem is : Problem G. String without repetitions (High)
http://codeforces.com/group/kzrMz4hb8l/contest/100385
Anyone has an idea how to solve it ?

//