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: Accepted

Solution code:
n = int(input())
A=input()
B=input()
C=input()
ans = 0
for i in range(n):
    s = {A[i], B[i], C[i]}
    ans += len(s) - 1
print(ans)

Submission status: Accepted

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

ans = 0
for i in range(N):
    if A[i]==B[i] and B[i]==C[i]: continue
    elif A[i]==B[i] and C[i]!=A[i]: ans += 1
    elif A[i]==C[i] and B[i]!=C[i]: ans += 1
    elif B[i]==C[i] and A[i]!=B[i]: ans += 1
    else: ans += 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()
s=0
for i in range(n):
    t=0
    if a[i]!=b[i]:
        t+=1
    if c[i]!=b[i]:
        t+=1
    if a[i]!=c[i]:
        t+=1
    if t:
        t-=1
    s+=t
print(s)

Submission status: Accepted

Solution code:
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    n = int(input())
    s = [input() for i in range(3)]

    ans = 0
    for i in range(n):
        t = 3
        for j in range(3):
            cur = 0
            for k in range(3):
                if s[j][i] != s[k][i]:
                    cur += 1
            t = min(t, cur)

        ans += t

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

count = 0
for i in range(N):
    if A[i] == B[i] and A[i] != C[i]:
        count += 1
    elif B[i] == C[i] and B[i] != A[i]:
        count += 1
    elif C[i] == A[i] and C[i] != B[i]:
        count += 1
    elif B[i] != C[i] and B[i] != A[i]:
        if A[i] != C[i]:
            count += 2
    else:
        count += 0
print(str(count))

Submission status: Accepted

Solution code:
n = int(input())
a = str(input())
b = str(input())
c = str(input())
ans = 0
list1 = []
for i in range(n):
    list1.append(a[i])
    list1.append(b[i])
    list1.append(c[i])
    set1 = set(list1)
    ans += len(set1)-1
    list1 = []
print(ans)

Submission status: Accepted

Solution code:
a=input()
N=int(a)
b=input()
first_input=[i for i in b]
c=input()
second_input=[i for i in c]
d=input()
third_input=[i for i in d]        
count=0
count2=0
while count2<N:
    if first_input[count2]==second_input[count2] and second_input[count2]==third_input[count2]:
        pass
    
    elif first_input[count2]==second_input[count2] or second_input[count2]==third_input[count2] or first_input[count2]==third_input[count2]:
        count+=1
    else:
        count+=2
    count2+=1
print(count)

Submission status: Accepted

Solution code:
import collections

n = int(input())
a = input()
b = input()
c = input()
#print(c[1])
ans = 0
for i in range(n):
    l = [a[i],b[i],c[i]]
    #print(l)
    ct = collections.Counter(l)
    #print(len(ct))
    ans += len(ct)-1
    
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=input()
B=input()
C=input()
cnt=0
for i in range(N):
    if A[i]!=B[i]and B[i]!=C[i]and C[i]!=A[i]:
        cnt+=2
    if A[i]==B[i]and C[i]!=A[i] and C[i]!=B[i]:
        cnt+=1
    if B[i]==C[i]and A[i]!=B[i] and A[i]!=C[i]:
        cnt+=1
    if C[i]==A[i]and B[i]!=A[i] and B[i]!=C[i]:
        cnt+=1
print(cnt)

Submission status: Accepted

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

#moji_dic={}
chage_num=0
for i in range(N):
    moji_dic={}
    moji_dic[A[i]] = moji_dic.get(A[i], 0) +1
    moji_dic[B[i]] = moji_dic.get(B[i], 0) +1
    moji_dic[C[i]] = moji_dic.get(C[i], 0) +1
    #print(moji_dic)
    if (moji_dic.keys())==[0]*N:
        no_change_num=0
    else:
        no_change_num=max(moji_dic.values())
    chage_num+=3-no_change_num
print(chage_num)

Submission status: Accepted

Solution code:
def read():
    N = int(input().strip())
    A = input().strip()
    B = input().strip()
    C = input().strip()
    return N, A, B, C


def solve(N, A, B, C):
    n_change = 0
    for i in range(N):
        same = 0
        if A[i] == B[i]:
            same += 1
        if A[i] == C[i]:
            same += 1
        if B[i] == C[i]:
            same += 1
        if same == 0:
            n_change += 2
        elif same == 1:
            n_change += 1
    return n_change


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))

Submission status: Accepted

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

total=0
for n in range(N):
  counter=0
  if A[n] == B[n] and B[n] == C[n]: 
    counter=0
  if A[n] != B[n] and A[n] == C[n] :
    counter=1
  if A[n] == B[n] and A[n] != C[n]: 
    counter=1
  if B[n] == C[n] and A[n] != B[n]:
    counter=1
  if A[n] != B[n] and B[n] != C[n] and C[n] != A[n]:
    counter=2

  total +=counter

print(total)

Submission status: Accepted

Solution code:
input_line=[int(input()),input(),input(),input()]
[i_N,i_A,i_B,i_C]=input_line
cnt=0
for x in range(i_N):
  if (i_A[x]==i_B[x]) & (i_A[x]==i_C[x]):
    continue
  elif (i_A[x]==i_B[x]) | (i_A[x]==i_C[x]) |  (i_B[x]==i_C[x]):
    cnt+=1
  else:
    cnt+=2
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
[A,B,C]=[input() for i in range(3)]
num = 0
for i in range(n):
    if A[i] == B[i]:
        if A[i] == C[i]:
            num += 0
        else:
            num += 1
    elif B[i] == C[i]:
        num += 1
    elif A[i] == C[i]:
        num += 1
    else:
        num += 2
print(num)

Submission status: Accepted

Solution code:
N = int(input())
word1 = list(input())
word2 = list(input())
word3 = list(input())
count = 0

for i in range(N):
    if word1[i] == word2[i]:
        if word1[i] == word3[i]:
            count += 0
        elif word1[i] != word3[i]:
            count += 1
    elif word1[i] != word2[i]:
        if word1[i] == word3[i]:
            count += 1
        elif word1[i] != word3:
            if word2[i] == word3[i]:
                count += 1
            elif word2[i] != word3[i]:
                count += 2


print(count)

Submission status: Accepted

Solution code:
N = int(input())

A = input()
B = input()
C = input()

count = 0

for i in range(N):
    if A[i] == B[i] != C[i]:
        count += 1
    elif B[i] == C[i] != A[i]:
        count += 1
    elif C[i] == A[i] != B[i]:
        count += 1
    elif A[i] != B[i] != C[i]:
        count += 2

print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
A = input()
B = input()
C = input()
lis = [defaultdict(int) for i in range(N)]

for i in range(N):
    lis[i][A[i]] += 1
    lis[i][B[i]] += 1
    lis[i][C[i]] += 1

comp = []
for i in range(N):
    comp.append(max(lis[i], key=lis[i].get))
comp = "".join(comp)
count = 0
for i in range(N):
    for word in lis[i]:
        if word == comp[i]:
            continue
        else:
            count += lis[i][word]
print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()
count=0
for i in range(n):
    if(a[i] == b[i]):
        if(a[i] != c[i]):
            count += 1
        else:
            continue
    elif(a[i]==c[i]):
        if(a[i] != b[i]):
            count+=1
        else:
            continue
    elif(b[i] == c[i]):
        if(b[i] != a[i]):
            count+=1
        else:
            continue
    else:
        count+=2
print(count)

Submission status: Accepted

Solution code:
n = int(input())
strings = [input() for _ in range(3)]
count = 0
for i in range(n):
    tmp = list(set([strings[0][i], strings[1][i], strings[2][i]]))
    if len(tmp) == 3:
        count += 2
    elif len(tmp) == 2:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
lst = []
count = 0
for i in range(3):
    lst.append(input())

for i in range(n):
    if not lst[0][i] == lst[1][i] == lst[2][i]:
        if (lst[0][i] == lst[1][i]) or (lst[1][i] == lst[2][i]) or (lst[0][i] == lst[2][i]):
            count += 1
        else:
            count += 2
print(count)

Submission status: Accepted

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

count = 0
for i in range(N):
  if not A[i] == B[i] == C[i]:
    if A[i] == B[i] or A[i] == C[i] or B[i] == C[i]:
      count += 1
    else: count += 2

print(count)

Submission status: Accepted

Solution code:
n=int(input())
sl=[input() for i in range(3)]
counter = 0
for i in range(n):
  s = set([])
  for j in range(3):
    s.add(sl[j][i:i+1])

  counter += len(s) -1

print(counter)

Submission status: Accepted

Solution code:
num = int(input())
words = []
while True:
    try:
        word = input()
        words.append(word)
    except EOFError:
        break

operation_num = 0

for i in range(len(words[0])):
    frequency = {}
    for word in words:
        frequency.setdefault(word[i], 0)
        frequency[word[i]] += 1
    if len(frequency) > 1:
        most_frequent_count = sorted(frequency.items(), key=lambda x : x[1])[-1][1]
        operation_num += len(words) - most_frequent_count

print(operation_num)

Submission status: Accepted

Solution code:
n = int(input())
a = [input() for i in range(3)]

count = 0
for k in range(n):
    this_set_len = len({a[0][k], a[1][k], a[2][k]})
    if (this_set_len == 2):
        count = count + 1
    elif (this_set_len == 3):
        count = count + 2

print(count)

Submission status: Accepted

Solution code:
cou=0
n=int(input())
a=input()
b=input()
c=input()
for i in range(n):
    if (a[i]==b[i] and a[i]!=c[i]) or (a[i]==c[i] and a[i]!=b[i]) or (b[i]==c[i] and b[i]!=a[i]):
        cou+=1
    elif a[i]!=b[i] and a[i]!=c[i]:
        cou+=2
print(cou)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
cnt = 0
for i in range(N):
    setl = [A[i],B[i],C[i]]
    setl = len(set(setl))
    if setl == 1:
        pass
    elif setl == 2:
        cnt += 1
    elif setl == 3:
        cnt += 2
print(cnt)

Submission status: Accepted

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


kaisuu = 0

for i in range(N):
    set_ = set([A[i], B[i], C[i]])
    if len(set_)==3:
        kaisuu += 2
    elif len(set_) == 2:
        kaisuu += 1

print(kaisuu)

Submission status: Accepted

Solution code:
N=int(input())

A=input()
A1=list(A) #文字列Aを一文字ごとにリストに格納
B=input()
B1=list(B)
C=input()
C1=list(C)
x=0
for i in range(0,N):#前から順に文字を調べていく
    if A1[i]==B1[i]==C1[i]:#文字を変えなくてよい時
        continue
    if A1[i]==B1[i] or B1[i]==C1[i] or C1[i]==A1[i]:#3つのうち1つだけ異なるとき(操作は1回)
        x=x+1
    else:#3文字バラバラの時(操作は2回)
        x=x+2
print(x)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
a = str(input())
b = str(input())
c = str(input())
x = int(0)
i =int(0)
j=int(0)
for i in range(n):
    j=0
    if a[i] == b[i]:
        if a[i] == c[i]:
            j=0
        else:
            j=1
    elif a[i] == c[i]:
        j=1
    elif b[i] == c[i]:
        j=1
    else:
        j=2
    x = x+j

print(x)

Submission status: Accepted

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

count = []
for i in range(n):
    if (int(a[i] == b[i]) + int(b[i] == c[i]) + int(c[i] == a[i])) == 3:
        count.append(0)
    elif (int(a[i] == b[i]) + int(b[i] == c[i]) + int(c[i] == a[i])) == 1:
        count.append(1)
    else:
        count.append(2)
print(int(sum(count)))

Submission status: Accepted

Solution code:
n = int(input())
a = str(input())
b = str(input())
c = str(input())

ans = 0
for i in range(n):
  chrs = set([a[i], b[i], c[i]])
  ans += len(chrs) - 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()

cnt = 0
for i in range(n):
    if len(set([a[i], b[i], c[i]])) == 3:
        cnt += 2
    if len(set([a[i], b[i], c[i]])) == 2:
        cnt += 1
print(cnt)

Submission status: Accepted

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


    count = 0
    for a, b, c in zip(A, B, C):
        unique_chars_length = len(set([a,b,c]))
        if unique_chars_length == 1:
            # すべて同じ文字のため操作は不要
            pass
        elif unique_chars_length == 2:
            # 文字が２種類存在するため、１回操作が必要
            count += 1
        elif unique_chars_length == 3:
            # 文字が３種類存在するため、２回操作が必要
            count += 2

    print(count)





main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 27 20:47:18 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*M
Y = [0]*M
for m in range(M):
    P[m], Y[m] = map(int, input().split())
    
all(nstr.count(c) for c in '753')
"""

N = int(input())
A = input()
B = input()
C = input()

result = 0

for n in range(N):
    if A[n] == B[n] and B[n] == C[n]:
        continue
    else:
        if A[n] == B[n] or B[n] == C[n] or C[n] == A[n]:
            result += 1
        else:
            result +=2
print(result)

Submission status: Accepted

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

res = 0
for i in range(N):
    if A[i] != B[i] or  A[i] != C[i] or  B[i] != C[i]:
        res+=1
    if A[i] != B[i] and A[i] != C[i] and B[i] != C[i]:
        res+=1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
    ans += len(set(a[i]+b[i]+c[i]))-1
print(ans)

Submission status: Accepted

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

for idx in range(N):
    if A[idx] == B[idx] and A[idx] == C[idx] and B[idx] == C[idx]:
        continue
    elif A[idx] == B[idx]:
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 1
    elif A[idx] == C[idx]:
        B = B[:idx] + A[idx] + B[idx+1:]
        cnt += 1
    elif B[idx] == C[idx]:
        A = A[:idx] + B[idx] + A[idx+1:]
        cnt += 1
    else:
        B = B[:idx] + A[idx] + B[idx+1:]
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 2
#print(A,B,C)
print(cnt)

Submission status: Accepted

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

cnt = 0

for i in range(N):
  s = set([A[i], B[i], C[i]])
  cnt += len(s) - 1

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
a=list(input())
b=list(input())
c=list(input())
ans=0
for i in range(n):
  if a[i] == b[i] and a[i] == c[i] and b[i] == c[i]:
    ans+=0
  elif a[i] != b[i] and a[i] == c[i] and b[i] == c[i]:
    ans+=1
  elif a[i] == b[i] and a[i] != c[i] and b[i] == c[i]:
    ans+=1
  elif a[i] == b[i] and a[i] == c[i] and b[i] != c[i]:
    ans+=1
  elif a[i] != b[i] and a[i] == c[i] and b[i] != c[i]:
    ans+=1
  elif a[i] == b[i] and a[i] != c[i] and b[i] != c[i]:
    ans+=1
  elif a[i] != b[i] and a[i] != c[i] and b[i] == c[i]:
    ans+=1
  elif a[i] != b[i] and a[i] != c[i] and b[i] != c[i]:
    ans+=2
print(str(ans))

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
if A == B == C:
    print(0)
else:
    count = 0
    for a, b, c in zip(A,B,C):
        if a == b == c:
            pass
        elif a == b and not a==c:
            count += 1
        elif a ==c and not a == b:
            count += 1
        elif b == c and not a == b:
            count += 1
        else:
            count += 2
    print(count)

Submission status: Accepted

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

ans = 0
for x, y, z in zip(a, b, c):
    if x == y and y == z:
        pass
    elif x == y or y == z or z == x:
        ans += 1
    else:
        ans += 2

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
A = input()
B = input()
C = input()


count = 0
for i in range(N):
    if A[i] == B[i] == C[i]:
        count += 0
    elif A[i] == B[i]:
        count += 1
    elif A[i] == C[i]:
        count += 1
    elif B[i] == C[i]:
        count += 1
    else:
        count += 2

    #print(i, ": ", count)

print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=input()
c=input()

s='abcdefghijklmnopqrstuvwxyz'

al=[]
bl=[]
cl=[]
ans=0
for i in range(n):
    si=[s.index(a[i]),s.index(b[i]),s.index(c[i])]
    sj=[]
    for j in range(len(set(si))):
        sj.append(si.count(list(set(si))[j]))
    ans+=(3-max(sj))
print(ans)

Submission status: Accepted

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

count = 2 * n

for i in range(n):
    if a[i] == b[i] or a[i] == c[i] or b[i] == c[i]:
        count -= 1
        if a[i] == b[i] and b[i] == c[i]:
            count -= 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()

res = 0

for i in range(n):
    res += len(set([a[i], b[i], c[i]])) - 1

print(res)

Submission status: Accepted

Solution code:
count = 0
N = int(input())
dic = {x:[] for x in range(N)}
for i in range(3):
    s = input()
    for j in range(N):
        dic[j].append(s[j])
for item in dic.values():
    s = set()
    for i in item:
        s.add(i)
    count+= len(s)-1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(input())
b = list(input())
c = list(input())
sum = 0
for i in range(n):
  if a[i] == b[i] == c[i]:
    sum = sum
  elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
    sum += 1
  else:
    sum += 2
print(sum)

Submission status: Accepted

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

ans = 0

for i in range(N):
    if A[i] == B[i]:
        if B[i] == C[i]:
            ans += 0
        else:
            ans += 1
    else:
        if B[i] == C[i]:
            ans += 1
        else:
            if C[i] != A[i]:
                ans += 2
            else:
                ans += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A =input()
B =input()
C =input()

L = [[A[i],B[i],C[i]] for i in range(N)]

c = 0
for l in L:
    l.sort()
    c += 3 - max(list(Counter(l).values()))
 
print(c)

Submission status: Accepted

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

if A == B and A == C and B == C:
    print(0)
    quit()

count = 0
for a, b, c in zip(A, B, C):
    if a != b and a != c and b != c:
        count += 2
    elif a == b and a == c and b ==c:
        continue
    else:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
list_str = []
for i in range(3):
  list_str.append(list(input()))
count = 0
for j in range(N):
    if list_str[0][j] == list_str[1][j] and list_str[1][j] == list_str[2][j] and list_str[2][j] == list_str[0][j]:
      count = count
    elif list_str[0][j] == list_str[1][j] and list_str[1][j] != list_str[2][j] and list_str[2][j] != list_str[0][j]:
      count = count + 1
    elif list_str[0][j] != list_str[1][j] and list_str[1][j] != list_str[2][j] and list_str[2][j] == list_str[0][j]:
      count = count + 1
    elif list_str[0][j] != list_str[1][j] and list_str[1][j] == list_str[2][j] and list_str[2][j] != list_str[0][j]:
      count = count + 1
    else:
      count = count + 2
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
result = []
for i in range(n):
    tmp = []
    tmp.append(a[i])
    tmp.append(b[i])
    tmp.append(c[i])
    tmp = list(set(tmp))
    result.append(len(tmp))
print(sum(result)-n)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
cnt = 0
for i in range(N):
  if(A[i] == B[i] != C[i]):
    cnt += 1
  elif(A[i] != B[i] == C[i]):
    cnt += 1
  elif(A[i] == C[i] != B[i]):
    cnt += 1
  elif(A[i] != B[i] != C[i]):
    cnt += 2
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
l=[0 for i in range(n)]
for i in range(n):
    if a[i] == b[i]:
        if b[i] == c[i]:
            l[i] = 0
        else:
            l[i] = 1
    else:
        if b[i] == c[i]:
            l[i] = 1
        else:
            if a[i] == c[i]:
                l[i] = 1
            else:
                l[i] = 2
s = sum(l)
print(s)

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline
import bisect

# template input
def IT():  # 整数1個
    return int(input())

def IL():  # 整数複数
    return [int(_) for _ in input().split()]

def IS():  # 文字列複数
    return [_ for _ in input().split()]

def ILS(n):  # 整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]

def SLS(n):  # 文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]

def ILSS(n):  # 整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

# template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)

def bit_full_search2(A):
    # https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                # output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x: x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val

def matching_bisect(list1_val, list2_val, n):
    # 2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                # ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""

def main():
    n = IT()
    a = input()
    b = input()
    c = input()

    count = 0
    for i in range(n):
        if a[i] == b[i] and b[i] == c[i]:
            pass
        elif b[i] == c[i] or a[i] == b[i] or a[i] == c[i]:
            count += 1
        else:
            count += 2
    print(count)

main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(input())
B = list(input())
C = list(input())
cnt = 0
for a, b, c in zip(A, B, C):
    if (a != b and a != c and b != c):
        cnt += 2
    elif (a == b != c):
        cnt += 1
    elif (a == c != b):
        cnt += 1
    elif (c == b != a):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:

N = int(input())
A = list(input())
B = list(input())
C = list(input())

d1=0
d2=0
for i in range(N):
    if A[i]==B[i]==C[i]:
        continue
    elif A[i]!=B[i]!=C[i]!=A[i]:
        d2+=1
    else:
        d1+=1
    
print(d1+d2*2)

Submission status: Accepted

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

def howManyDiff(a, b, c):
    if (a == b == c):
        return 0
    elif (a == b):
        return 1
    elif (b == c):
        return 1
    elif (a == c):
        return 1
    else:
        return 2

totalDiff = 0
for i in range(N):
    totalDiff += howManyDiff(A[i], B[i], C[i])

print(totalDiff)

Submission status: Accepted

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 += len(s) - 1
    s.clear()

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
count = 0
for i in range(N):
    if A[i] == B[i] and B[i] == C[i]:
        continue
    elif A[i] == B[i]:
        C[i] == A[i]
        count += 1
    elif A[i] == C[i]: 
        B[i] == A[i]
        count += 1
    elif B[i] == C[i]:
        A[i] == B[i]
        count += 1
    else:
        B[i] == A[i]
        C[i] == A[i]
        count += 2
print(count)

Submission status: Accepted

Solution code:
N=int(input())
A=input()
B=input()
C=input()
#print(A[1])
count=0

for i in range(0,N):
    if A[i]==B[i]==C[i]:
        count=count+0
    elif A[i]!=B[i] and B[i]!=C[i] and A[i]!=C[i]:
        count=count+2
    else:
        count=count+1

print(count)

Submission status: Accepted

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

cost = 0
for i in range(N):
  s = set()
  s.add(A[i])
  s.add(B[i])
  s.add(C[i])
  cost += len(s) - 1

print(cost)

Submission status: Accepted

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


c=0
for i in range(N):
    if A[i]==B[i] and B[i]==C[i]:
        continue
    if A[i]==B[i] or B[i]==C[i] or C[i]==A[i]:
        c+=1
    else:
        c+=2
print(c)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
A = input()
B = input()
C = input()
n = 0
for i in range(N):
    a, b, c = A[i], B[i], C[i]
    if a != b:
        n += 1
        if a == c or b == c:
            continue
        else:
            n += 1
    elif b != c:
        n += 1
print(n)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
A = input()
B = input()
C = input()

times = 0
for i in range(N):
    c = Counter([A[i], B[i], C[i]])
    times += 3 - c.most_common()[0][1]

print(times)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
x = 0
for i in range(N):
    letters = len({A[i], B[i], C[i]})
    if letters == 2:
        x += 1
    elif letters == 3:
        x += 2
print(x)

Submission status: Accepted

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

count = 0

for i in range(N):
    flg = A[i]
    if flg==B[i]:
        if flg==C[i]:
            continue
        else:
            count += 1
            continue
    else:
        if flg==C[i]:
            count+=1
        else:
            if B[i]==C[i]:
                count += 1
            else:
                count += 2
print(count)

Submission status: Accepted

Solution code:
def func (S, T, U, N):
  cnt = []
  for i in range(N):
    if S[i] == T[i] and S[i] == U[i]:
      cnt.append(0)
    elif S[i] == T[i] or S[i] == U[i] or T[i] == U[i]:
      cnt.append(1)
    else:
      cnt.append(2)
      
  return cnt


N = int(input())
A = input()
B = input()
C = input()

print(sum(func(A, B, C, N)))

Submission status: Accepted

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

count = 0
for i in range(N):
  if A[i] == B[i] and B[i] == C[i]:
    continue
  elif A[i] == B[i]:
    count += 1
  elif B[i] == C[i]:
    count += 1
  elif C[i] == A[i]:
    count += 1
  else:
    count += 2
    
print(count)

Submission status: Accepted

Solution code:

N=int(input())
A=list(input())
B=list(input())
C=list(input())
count=0
for i in range(len(A)):
    if A[i]!=B[i] or A[i]!=C[i] or B[i]!=C[i]:
        judege=[A[i],B[i],C[i]]
        judege=[judege.count(A[i]),judege.count(B[i]),judege.count(C[i]),]
        #print(max(judege))
        if max(judege)==1:
            count+=2
        elif max(judege)==2:
            count+=1
                
        
    
print(count)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
A = list(input())
B = list(input())
C = list(input())
count = 0
for i in range(N):
    tmpA = A[i]
    tmpB = B[i]
    tmpC = C[i]
    a = Counter([tmpA,tmpB,tmpC])
    count+= 3 - a.most_common()[0][1]
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = input()
c = input()
opcount = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        pass
    elif a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        opcount += 1
    else:
        opcount += 2
print(opcount)

Submission status: Accepted

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]])
    # print(len(s))
    if len(s) == 1:
        ans+=0
    elif len(s) == 2:
        ans += 1
    elif len(s) == 3:
        ans += 2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
count = 0
for i in range(N):
    if A[i] == B[i]:
        if A[i] == C[i]:
            count += 0
        else:
            count += 1
    else:
        if A[i] == C[i]:
            count += 1
        elif B[i] == C[i]:
            count += 1
        else:
            count += 2

print(count)

Submission status: Accepted

Solution code:
N = int(input())
A = input()
B = input()
C = input()
counter = 0
for i in range(N):
    if(A[i]==B[i]):
        if(B[i]==C[i]):
            continue
        else:
            counter+=1
    elif(A[i]==C[i]):
        if(B[i]==C[i]):
            continue
        else:
            counter+=1
    elif(B[i]==C[i]):
        if(A[i]==B[i]):
            continue
        else:
            counter+=1
    else:
        counter+=2

print(counter)

Submission status: Accepted

Solution code:
n, a, b, c = [input() for i in range(4)]
n = int(n)

s = []
t = 0
for i in range(n):
    s.append([a[i], b[i], c[i]])
    t += len(set(s[i])) - 1

print(t)

Submission status: Accepted

Solution code:
#coding:utf-8

n = int(input())
a = input()
b = input()
c = input()
ans = 0

for i in range(n):
  if a[i]==b[i] and b[i]==c[i] and c[i]==a[i]:
    continue
  elif a[i]==b[i] or b[i]==c[i] or c[i]==a[i]:
    ans += 1 
  else:
    ans += 2

print(ans)

Submission status: Accepted

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

diff = 0
for i in range(N):
	s = {A[i],B[i],C[i]}
	diff += len(s) - 1

print(diff)