#K8616. Minimum Moves to Form String
Minimum Moves to Form String
Minimum Moves to Form String
You are given an initially empty primary string. In one move, you can either append a character to the end of the string or remove the last character from the string. Given a target string, your task is to determine the minimum number of moves required to form the target string using only these operations.
Note: Since you start with an empty string and you are only allowed to append characters at the end or remove characters from the end, the minimum number of moves is simply the length of the target string (i.e., you append each character of the target string).
Example:
Input: target = "abc" Output: 3 Explanation: Append 'a', then 'b', then 'c'.
inputFormat
The first line of input contains a single integer t (1 ≤ t ≤ 105), representing the number of test cases. Each of the following t lines contains a target string. The target string may be empty.
outputFormat
For each test case, output a single line containing the minimum number of moves required to form the corresponding target string.
## sample2
abc
aaa
3
3
</p>