Time limit
1s
Memory limit
128 MB
A replacement operation on a string changes one character at one position to another character. For instance, changing the fourth character p in computer to m produces commuter.
For two strings P and Q of the same length, the distance d(P, Q) is the minimum number of replacement operations needed to change P into Q. If P = computers and Q = consumers, they differ in three positions, so d(P, Q) = 3.
For three strings A, B, and C of the same length, the radius of a string W is the maximum distance from W to those three strings.
r(W) = max(d(W, A), d(W, B), d(W, C))
A median string of A, B, and C is a string whose radius is as small as possible. Given three same-length strings A, B, and C consisting only of lowercase English letters, find the radius of a median string and output one such string.
The first line contains the string A.
The second line contains the string B.
The third line contains the string C.
All three strings consist only of lowercase English letters and have the same length. Their length is between 1 and 100,000, inclusive.
Print the minimum possible radius of a median string on the first line.
Print one median string on the second line.
If there are multiple median strings, output any one of them.