题意:
解法:
观察到n只有100,那么可以暴力枚举两个串中间合并了多少长度.
code:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxm=2e5+5;
char s[maxm];
char t[maxm];
int n;
void solve(){
cin>>n;
cin>>(s+1);
cin>>(t+1);
int ans=n*2;
for(int i=1;i<=n;i++){
int ok=1;
for(int j=n-i+1,k=1;k<=i;j++,k++){
if(s[j]!=t[k]){
ok=0;
break;
}
}
if(ok){
ans=n*2-i;
}
}
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(0);
solve();
return 0;
}