Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<string>
- #include<vector>
- using namespace std;
- typedef long long int ll;
- typedef long double ld;
- typedef unsigned long long int ull;
- typedef long long li;
- #define ms(x,a) memset(x,a,sizeof(x))
- #define forn(i, n) for (int i = 0; i < int(n); i++)
- #define pi acos(0.0)*2 // 3.1415926535897932
- #define mxx 100000007
- #define mod 1000000007
- #define base 10000007
- #define pb push_back
- void inOut();
- int max(int a, int b);
- int lcs( char *X, char *Y, int m, int n )
- {
- int L[m+1][n+1];
- int i, j;
- for (i=0; i<=m; i++)
- {
- for (j=0; j<=n; j++)
- {
- if (i == 0 || j == 0)
- L[i][j] = 0;
- else if (X[i-1] == Y[j-1])
- L[i][j] = L[i-1][j-1] + 1;
- else
- L[i][j] = max(L[i-1][j], L[i][j-1]);
- }
- }
- return L[m][n];
- }
- int max(int a, int b)
- {
- return (a > b) ? a : b;
- }
- int main()
- {
- //inOut();
- int i,j;
- char s[100005],s1[100005];
- cin>>s>>s1;
- int m = strlen(s);
- int n = strlen(s1);
- int mx =lcs(s, s1, m, n);
- //cout<<mx<<endl;
- //int sz2 = lcs(s, s1, m, n);
- //int mx = max(sz1, sz2);
- double bro = (m*0.99);
- if(mx>=bro)
- cout<<"Long lost brothers D:"<<endl;
- else
- cout<<"Not brothers :("<<endl;
- return 0;
- }
- void inOut()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- #endif
- }
Add Comment
Please, Sign In to add comment