I tried to solve the DISUBSTR problem using suffix tree and count the number of characters inserted. This appears to work for most of my test cases, except SPOJ complains about SIGSEGV.
My code can be found at
http://ideone.com/whHgsm
I would appreciate if someone can spot what could be the reason for the runtime error. I am using c99-strict compiler.