-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1035.cpp
More file actions
26 lines (26 loc) · 703 Bytes
/
1035.cpp
File metadata and controls
26 lines (26 loc) · 703 Bytes
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
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
using namespace std;
string a, b;
main(void) {
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> a >> b;
int gmax = 0;
for (int i = 0; i < a.length() - gmax; i++) {
int sum = 0, l = MIN(a.length() - i, b.length());
for (int j = 0; j < l; j++)
if (a[i + j] == b[j]) sum++;
gmax = MAX(gmax, sum);
}
for (int i = 0; i < b.length() - gmax; i++) {
int sum = 0, l = MIN(a.length() - i, b.length());
for (int j = 0; j < l; j++)
if (b[i + j] == a[j]) sum++;
gmax = MAX(gmax, sum);
}
cout << gmax << '\n';
return 0;
}