C++ 代码
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
string s1,s2;
cin >> n >> s1 >> s2;
bool st[n + 1];
memset(st, false, sizeof st);
for (int i = 0; i < n; i ++ )
if(s1[i] != s2[i]) st[i] = true;
int ans = 0;
for (int i = 0; i < n; i ++ )
if(st[i] == true)
{
while(st[i] == true) i++ ;
ans ++;
}
cout << ans << endl;
return 0;
}