String Manipulation

this is a question, and it seems very intresting problem all you have to do is just read it, i dont think you can stop yourself to solve it because the problem is easy to understand but the restrictions are very tight :slight_smile:

here is the problem http://codeforces.com/problemset/problem/159/C