Eloa’s Secret

Limits 2s, 512 MB

Eloa, the princess of Byteland has a secret. She is obsessed with Alien names. The general convention of human name is “First name + Space + Last name”. There is one difference in alien name. The space replaced by a “:”. For example, “donald:trump” is a valid alien name. Obviously first name and last name can’t be empty. They must have at least one character each and only consists of lowercase English letters. Eloa has a long string S consists of lowercase English letters and “:”. She wants to know how many distinct sub-strings of S are there which can be considered as valid alien names. As she is very busy doing her makeup for the upcoming beauty contest, she ask you to do the task. Remember, you have to find the answer before she finishes her makeup. Otherwise the King of Byteland will hang you!

This is a companion discussion topic for the original entry at https://toph.co/p/eloa-s-secret