My mom has a habit of leaving me instructions for house chores on colored notes, stuck on a panel, by the fridge. The notes are rectangular, all have the same height (equal to the height of the panel), but various lengths.
Mom never throws away old notes, and just sticks new ones over the existing ones. No part of the panel can be seen now; the only thing that can be seen are the colors of the notes stuck there.
Every morning when I drink my coffee I ask myself the same question over and
over again: How many notes are there?
But because I'm too lazy to count them, I'd rather write a program that determines the minimum number of notes on the panel.
For this purpose I encode the colors of the notes by using capital English alphabet letters (associating one letter to each centimeter of color visible).
Task
Write a program which, upon analyzing the colors visible on the panel, determines the minimum number of notes.
Input Data
Input file bilete.in contains a single line, which contains a sequence of capital English alphabet letters, representing the colors visible on the panel.
Output Data
Output file bilete.out will contain a single line with the minimum number of notes on the panel.
Constraints and Statements
bilete.in | bilete.out | Explanation |
ABCCCBAABA |
4 | One possible solution is: Mom stuck a note color A, 10 cm long. Then she stuck (1 cm away from the left panel edge) a color B note, 5 cm long. Then she stuck (2 cm away from the panel edge) a color C note, 3 cm long. The last note stuck (8 cm away from the panel edge) was a color B note, 1 cm long. |
Time limit: 0.1 seconds/test
prof. Emanuela Cerchez
"Grigore Moisil" Iaşi IT High School
Contact:emanuela.cerchez@gmail.com