W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem [email protected].
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, zapraszamy na serwery Discord. Są one moderowane przez społeczność, ale członkowie zespołu technicznego też są tam aktywni.
Every sequence of small letters and (also the empty sequence) is called an ab-word. If is an ab-word and are integers such that then denotes the subword of consisting of the letters . We say that an ab-word is nice if it has as many letters as and for all the subword has at least as many letters as .
Now, we give the inductive definition of the similarity between nice ab-words:
A level of diversity of a non-empty set of nice ab-words is the maximal number of ab-words that can be chosen from in such a way that for each pair of chosen words, is not similar to .
Write a program that:
In the first line of the standard input there is a number of elements of the set , ; in the following lines there are elements of the set , i.e. nice ab-words (one word in each line); the first letter of every ab-word is the first symbol in line and there are no spaces between two consecutive letters in the word; the length of every ab-word is an integer from the range .
In the first and only line of the standard output there should be written one integer — the level of diversity of .
For the input data:
3 aabaabbbab abababaabb abaaabbabb
the correct result is:
2
Task author: Krzysztof Diks.