Problem:


Score : 200 points

Problem Statement

You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.

Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:

Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.

What is the minimum number of operations required to achieve the objective?

Constraints

1 \leq N \leq 100

Each of the strings A, B and C is a string of length N.

Each character in each of the strings A, B and C is a lowercase English letter.

Input

Input is given from Standard Input in the following format:

N
A
B
C

Output

Print the minimum number of operations required.

Sample Input 1

4
west
east
wait

Sample Output 1

3

In this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:

Change the second character in A to a. A is now wast.

Change the first character in B to w. B is now wast.

Change the third character in C to s. C is now wast.

Sample Input 2

9
different
different
different

Sample Output 2

0

If A, B and C are already equal in the beginning, the number of operations required is 0.

Sample Input 3

7
zenkoku
touitsu
program

Sample Output 3

13



Sample input:
4
west
east
wait


Sample output:
3

Submission status: Runtime Error

Solution code:
l = input().split()   
count = 0
for i in range(l[0]):
    if (l[1][i] != l[2][i])&(l[1][i] != l[3][i]):
        l[2][i] == l[1][i]
        count = 1 + count
        #print(count,l[2])
        if l[1][i] != l[3][i]:
            l[3][i] == l[1][i]
            count = 1 + count
            #print(count, l[3])
        else:
            continue
    elif l[1][i] != l[3][i]:
        l[3][i] == l[1][i]
        count = count + 1
        #print(count, l[3])
    else:
        continue

print(count)

Submission status: Runtime Error

Solution code:
l = stdin.readline().rstrip().split()
count = 0
for i in range(l[0]):
    if (l[1][i] != l[2][i])&(l[1][i] != l[3][i]):
        l[2][i] == l[1][i]
        count = 1 + count
        #print(count,l[2])
        if l[1][i] != l[3][i]:
            l[3][i] == l[1][i]
            count = 1 + count
            #print(count, l[3])
        else:
            continue
    elif l[1][i] != l[3][i]:
        l[3][i] == l[1][i]
        count = count + 1
        #print(count, l[3])
    else:
        continue

print(count)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    N, A, B, C = input().split()

    ans = 0
    for i in range(int(N)):
        dif1 = int(A[i] != B[i])
        dif2 = int(B[i] != C[i])
        dif3 = int(C[i] != A[i])

        ans += max(dif1 + dif2 + dif3 - 1, 0)

    print(ans)

Submission status: Runtime Error

Solution code:
import sys

if __name__ == '__main__':
    N, A, B, C = sys.argv[1:5]

    ans = 0
    for i in range(int(N)):
        dif1 = int(A[i] != B[i])
        dif2 = int(B[i] != C[i])
        dif3 = int(C[i] != A[i])

        ans += max(dif1 + dif2 + dif3 - 1, 0)

    print(ans)

Submission status: Runtime Error

Solution code:
target_list = []
for a, b, c in zip(A, B, C):
    if a==b and b==c:
        target_list.append(3)
    elif a==b or a==c:
        target_list.append(2)
    else:
        target_list.append(1)
print(N*3 - sum(target_list))

Submission status: Runtime Error

Solution code:
l = stdin.readline().rstrip().split()
N = len(l[0])
print(N)

Submission status: Runtime Error

Solution code:
N = int(input())
A =  input()
B =  input()
C =  input()

str_len = len(A)

count = 0


for i in range(str_len):
   #print(f’i: {i}’)
   if A[i]==B[i]:
       if C[i]==B[i]:
           continue
       else:
           count = count + 1
   elif A[i]==C[i]:
       count = count + 1
   elif B[i]==C[i]:
       count = count + 1
   else:
       count = count + 2
print(str(count))

Submission status: Runtime Error

Solution code:
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(len(s)):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())
L = [input() for i in range(3)]
ans = [0] * N.
tmp = []
for i in range(N):.
  for j in range(3):
      tmp.append(L[j][i])
  ans[i] = len(set(tmp)) - 1
  tmp = []
print(sum(ans))

Submission status: Runtime Error

Solution code:
n=int(input())
a=input()
b=input()
c=input()
abc=list('0000')
for i in range(n):
    if a[i]==b[i]:
        abc[i]=a[i]
    if b[i]==c[i]:
        abc[i]=b[i]
    if c[i]==a[i]:
        abc[i]=c[i]
count=0
for i in range(n):
    if a[i]!=abc[i]:
        count+=1
    if b[i]!=abc[i]:
        count+=1
    if c[i]!=abc[i]:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
s=[i for i in range(3)]
cnt=0
for j in range(n):
  cnt+=len(set(s[0][j],s[1][j],s[2][j])-1
print(cnt)

Submission status: Runtime Error

Solution code:
n=int(input())
a=input()
b=input()
c=input()
al=list(a)
bl=list(b)
cl=list(c)

count=0
for i in range(n):
    if al[i]==bl[i]:
        if al[i]==cl[i]:
            plus=2
        elif:
            plus=1
    elif bl[i]==cl[i]:
        plus=1
    elif al[i]==cl[i]:
        plus=1
    else:
        plus=0
        
    count+=plus
    
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
A = input()
B = input()
C = input()

ans = 0

for i in range(N):
  S = set(A[i], B[i], C[i])
  ans += S.__len__() - 1

print(ans)