Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin ("sclm.in");
- ofstream fout ("sclm.out");
- char s[1026], t[1026];
- int N, M, a[1026][1026], mx, in1, in2;
- int main() {
- fin >> N >> M >> (s + 1) >> (t + 1);
- for (int i = 1; i <= N; i ++)
- for (int j = 1; j <= M; j ++)
- if (s[i] != t[j])
- a[i][j] = 0;
- else {
- a[i][j] = a[i - 1][j - 1] + 1;
- if (a[i][j] > mx) {
- mx = a[i][j];
- in1 = i;
- in2 = j;
- }
- }
- fout << mx << ' ' << in1 - mx + 1 << ' ' << in2 - mx + 1 << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement