Author: | A. Baranov | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 512 Mb | |
Output file: | Standard output |
Let there be two strings A and B, consisting of digits and lowercase Latin characters.
On the string A, we define the operation SWAP(i, i + 1), which consists in exchanging the characters at positions i and i + 1.
It is required to determine the minimum number of such operations for transforming string A to string B.
Input contains two strings: A and B.
Output must contain a single integer.
It is guaranteed that the required transformation can be performed.
Line lengths do not exceed 2 ⋅ 105.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|