In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you are familiar with IRC chat, the support team is also reachable on PIRC network (irc.pirc.pl
) in #szkopul
channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
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.