You are given an integer n. You are also given four strings a, b, c, d of lengths n consisting of lowercase English letters (from "a
" to "z
").
In one operation, you can choose any of these strings and change any character of it to any lowercase English letter. You need to find the minimum number of operations you need to do to divide the given strings into two pairs of equal strings that are different from each other. In other words, it needs to become possible to swap all the strings between each other in such a way that the condition a=b=c=d holds.
The first line contains an integer number n (1≤n≤100) — the lengths of the strings.
In the next four lines, there are four strings, one string per line: a, b, c, and d. All the strings have equal lengths of n, and all the strings consist of lowercase English letters.
In the only line, you have to output the minimum number of operations you need to do to satisfy the given conditions.
In the first example, you can choose the second string and perform these 3 operations:
changing the first character to "e
";
the second one to "r
";
the third one to "e
".
After performing these operations, we achieve the second string equal to the third one. Note that the first and last strings are already equal. So after these 3 operations, we achieve what we need. It can be proved that you can not do it in 2 or fewer operations.
(9 points): s1=s2=s3=s4;
(9 points): s1=s2=s3;
(14 points): s1=s2;
(30 points): n=1;
(38 points): no additional constraints.