#include<bits/stdc++.h> using namespace std; char a[1010],b[1010]; int ans; int key=0;//置为0表示关闭计数 int main() { scanf("%s",a); scanf("%s",b); for(int i=0;a[i]!='\0';i++) { if(a[i]!=b[i]&&key==0) { key=1; ans++; continue; } if(a[i]==b[i]&&key==1) { ans++; continue; } if(a[i]!=b[i]&&key==1) { key=0; continue; } } printf("%d",ans); return 0; }标签:&&,P8597,蓝桥,int,key,ans,2013 From: https://www.cnblogs.com/cornfield/p/17399518.html