#C9748. Minimum Key Presses
Minimum Key Presses
Minimum Key Presses
You are given a target string T and you have a special keyboard with two operations:
- Append: Append a character to the end of the current string.
- Delete: Delete the last character of the current string.
Your task is to compute the minimum number of key presses required to type the given target string. Note that in the optimal strategy all you need is to press the Append key for every character. Hence, if the target string is of length n, the minimum number of key presses is:
Example:
Input: abcde Output: 5
inputFormat
The input consists of a single line containing a non-empty string T composed of printable characters.
outputFormat
Output an integer denoting the minimum number of key presses required to type the string.
## sampleabcde
5