Hello everyone!

Recently, I studied Suffix Automata from e-maxx's site. I think, I got it.

After solving some problems from SIS(LKSH) archives I moved to Online Judges. Didn't find any related problems on timus, found some on CodeForces. They were successfully done.

Problem I go stuck with is Names for Babies, please help to solve it!

Actually, I got some problems with constructing dynamic on suffix tree for linear time. Can you give some hints for solving such type of problems? Any main ideas or anything... I understood dynamic on suffix structures of another type(example is problem Censored on timus), but types like "number of different substrings", "total length of different substrings", etc. look like something difficult.

Any help is welcomed!

[picture of bicycle here]

languages I understand: english, русский, turkce, 中國, 한국의, Deutsch...

Just jocking, at least I understand first two of them.