Nop-Croatia
Mirko purchased a new microprocessor. Unfortunately, he soon learned that many of his programs that he wrote for his old processor didn't work on the new processor. Deep inside the technical documentation for both processors, he found an explanation. In order to work faster, the new processor imposes certain constraints on the machine code of programs, constraints that never existed on the previous model. The machine code of a processor consists of instructions that are executed sequentially. Each instruction uses a byte of memory. Also, instructions can have zero or more parameters, each of which uses an additional byte of memory. In machine code, parameters immediately follow an instruction. When formatted as text, machine code instructions are uppercase letters, while parameters are lowercase letters. For example:
Write a program that determines the smallest number of NOP instructions that need to be inserted for the given program to work on the new processor model.
The program will always start in an instruction i.e. the first letter in the machine code will be uppercase. If an instruction appears more than once in the machine code, it will always take the same number of parameters.
Input
Abcd
Output
0 Input
EaEbFabG
Output
5 Input
AbcbBccCDefgh
Output
4 Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.