#include<bits/stdc++.h> using namespace std; const int N=1e6+5;; char a[N],b[N]; int main() { int n; cin>>n; cin>>a; cin>>b; int ans=0; int i,j=n-1; for(i=n-1;i>=0;i--){ if(a[i]==b[j]) j--; else ans++; } cout<<ans; return 0; }
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 追梦算法网 universal account