#P15951. [ICPC 2018 Jakarta R] Edit Distance
[ICPC 2018 Jakarta R] Edit Distance
题目描述
A binary string is a non-empty sequence of 's and 's, e.g., , , , etc. The edit distance of two binary strings and , denoted by , is the minimum number of single-character edit (insert, delete, or substitute) to modify into . For example, the edit distance of and is , i.e. . The edit distance of and is , i.e. .
Ayu has a binary string . She wants to find a binary string with the same length as that maximizes the edit distance with . Formally, she wants to find a binary string such that and for all binary string satisfying .
She needs your help! However, since she wants to make your task easier, you are allowed to return any binary string with the same length as such that the edit distance of and is more than half the length of . Formally, you must return a binary string such that and .
Of course, you can still return if you want, since it can be proven that for any binary string . This also proves that there exists a solution for any binary string . If there is more than one valid solution, you can output any of them.
输入格式
Input contains a binary string ().
输出格式
Output in a line a binary string with the same length as that satisfies .
0011
1100
1100101
0011010
提示
Explanation for the sample input/output #1
As illustrated in the example above, the edit distance of and is . Since , is one of the valid output for this sample.