1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int arr[50]; string a, b; cin >> a >> b; int m = 50; for (int i = 0; i < b.size() – a.size() + 1; i++) { int t = 0; for (int j = 0; j < a.size(); j++) { if (b[i + j] != a[j]) t++; } m = min(m, t); } cout << m << endl; return 0; } | cs |