Files
usaco/solved/mad-scientist/sol.py
T
2026-08-03 19:03:58 +01:00

23 lines
450 B
Python

# Farmer John orders N cows, of two breeds
# H for Holstein or G for Guernsey
# A string is the breed identifiers John originally wanted
# B string is the string when the cows arrive
read = open("breedflip.in")
n = int(read.readline())
A = read.readline()
B = read.readline()
cnt = 0
res = 0
for i in range(n):
if A[i] != B[i]:
cnt += 1
elif cnt != 0:
cnt = 0
res += 1
print(res, file=open("breedflip.out", "w"))