|
|||
Typewriter again
Péter has an old typewriter where the keys (symbols) are arranged side by side, and some may appear multiple times. Before starting to type, a head must be placed at one of the positions located at the ends of the typewriter (these positions are marked with an underscore (_) in the typewriter’s description). The head can move left and right over the keys. There is also a button that, when pressed, sends the symbol currently under the head into the typewriter’s memory. Moving to an adjacent key takes 1 second, while the time required to press the button is negligible. For each line of text provided, calculate the minimum number of time units required to transfer the text into the typewriter’s memory.Input specification
The first line contains the typewriter: a string of length
,
delimited by underscore ( Output specificationThe output should consist of lines, each containing the computed result. If it is not possible to input the given text into the typewriter’s memory, output . Constraints
Sample input 1
Sample output 1
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |