First part, I guess. Even if you think that you are familiar with suffix tree, please, take a look at the code below. It may be interesting to you.
Hi everyone! Finally I learnt this one :)
In this entry I would like to avoid long and complex theory which scared me from suffix tree for a long time. So straight to the point. I will not prove algorithm if you want some proofs, you may check stackoverflow or Dan Gusfield's book... Or somewhere else, I don't know.