P9950
liushuaishuai · · 题解
题目
P9950。
思路
用循环枚举,遇到不同的继续枚举下一个,遇到相同的就停下来计数。
代码
#include <bits/stdc++.h>
using namespace std;
int n, sum;
string a, b;
int main(){
cin >> n >> a >> b;
for (int i = 0; i < n; i++){
if (a[i] == b[i]) continue;
while (a[i] != b[i]) i++;
sum++;
}
cout << sum;
return 0;
}