提交时间:2023-12-16 09:16:50
运行 ID: 116211
#include<iostream> #include<string> using namespace std; const int N = 1e3 + 10; int l1, l2, ans = 0; string s1, s2; int main(){ cin >> s1 >> s2; l1 = s1.size(); l2 = s2.size(); if(l1 < l2){ swap(s1, s2); swap(l1, l2); } for(int i = 0; i < l1; i++){ int cnt = 0, idx = i; for(int j = 0; j < l2; j++){ if(s1[idx] == s2[j]){ idx++; cnt++; } if(idx >= l1) break; } ans = max(ans, cnt); } cout << l1 - ans; return 0; }