In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Byteasar wants to put a rather long pattern on his house. In order to do this, he has to prepare an appropriate template with letters cut off first. He is going to put the pattern on the wall by putting the pattern on the wall in the appropriate place and painting over it. This way he can "print" all the letters that are on the template at one time (it is not possible to "print" only some of them). It is, however, possible, to paint some letters on the wall several times, as a result of different applications of the template. The letters on the template are adjacent (there are no spaces on it). Of course, it is possible to prepare a template with the whole pattern on it. But Byteasar would like to minimize the cost, so he wants to make a template as short as possible.
Write a programme that:
In the first and only line of the standard input there is one word. It is the pattern Byteasar wants painted on his house. It consists of no more than and no less than lower-case (non-capital) letters of the English alphabet.
In the first and only line of the standard output one integer should be written - the minimal number of letters in the template.
For the input data:
ababbababbabababbabababbababbaba
the correct result is:
8
The above picture illustrates how to "print" the word from the sample input using template ababbaba.
Task author: Wojciech Rytter.