#!/usr/local/bin/python3 r=[5, "APPLE", "LEAPP"] num=int(r[0]) total=0 model=[] target=[] for i in range(num): model.append(r[1][i]) target.append(r[2][i]) def sorten(total): for i in range(num): if model[i]!=target[i]: moji=target[0] target.pop(0) target.append(moji) total+=1 sorten(total) print(total) sorten(total)