fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n; cin >> n;
  7. string a,b; cin >> a >> b;
  8. int result=0;
  9. for(int i=0;i<n;++i) {
  10. if(a[i]==b[i]) continue;
  11. int j=i;
  12. for(;j<n;++j) {
  13. if(a[j]!=b[j]) continue;
  14. else break;
  15. }
  16. i=j;
  17. ++result;
  18. }
  19. cout << result << "\n";
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5288KB
stdin
7
GHHHGHH
HHGGGHH
stdout
2