Helo, I had to learn Ukkonen's algorithm in order to solve this question. So I searched something found this, and this, and this, and this. Decided that I understood theory and could proceed to implementation of this problem. I tried to implement it readably and reliable and tested it a bit and received TL afterwards optimized and got TL with this, so I rewrote code and still got TL and my vacation run to an end. Can you please help me and tell what am I missing (seems like major difference from [user:e-maxx]'s implementation is that I am calculating suffix links not on the fly but when coming to next vertex (it is suffix link of previous) Thank you and kiitos