求大神指点
查看原帖
求大神指点
1587166
eric_whj楼主2024/11/20 11:39

flage=0 def finddi(s1,s2): for i in range(len(s1)): if s1[i]!=s2[i]: return i def fanzhuani(s1): i=finddi(s1,s2) r=list(s1) if r[i]=="": r[i]="o" else: r[i]="" if r[i+1] == "": r[i+1] = "o" else: r[i+1] = "" result="".join(r) return result s1=input() s2=input() while(1): s1=fanzhuani(s1) flage+=1 if s1==s2: print(flage) exit(0)

2024/11/20 11:39
加载中...