One day, Apollo and Avery find a collection T of n spells, each of which can be obtained by repeating some section infinitely. For example, by repeating the section 'abc', we can get the spell 'abcabcabc...'. The two kids learnt how to count common substrings of many strings in Mr.Calabash's string course yesterday. However, they find it hard to count that of these spells. Can you help the two poor kids?Let F be the set of all substrings of spell s. You should tell the two kids ∣s∈TF∣|bigcap_{s in T} F|∣s∈TF∣.
One day, Apollo and Avery find a collection T of n spells, each of which can be obtained by repeating some section infinitely. For example, by repeating the section 'abc', we can get the spell 'abcabcabc...'. The two kids learnt how to count common substrings of many strings in Mr.Calabash's string course yesterday. However, they find it hard to count that of these spells. Can you help the two poor kids? Let F(s) be the set of all substrings of spell s. You should tell the two kids ∣⋂s∈TF(s)∣|bigcap_{s in T} F(s)|∣⋂s∈TF(s)∣.