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.
Can you please help me and tell what am I missing (seems like major difference from 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