Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(){
- string a, b, c, buf;
- cin >> a >> b >> c;
- if (a.length() <= b.length() and a.length() <= c.length()) buf = a;
- else if (b.length() <= a.length() and b.length() <= c.length()) buf = b;
- else buf = c;
- vector<string> vec;
- for (int i = 1; i <= buf.length(); i++) {
- ll tt = 0;
- for (int l = 0; l < buf.length() - i + 1; l++) {
- string ar;
- for (int j = 0; j < i; j++) { ar = ar + buf[l + j]; }
- if (a.find(ar) != string::npos && b.find(ar) != string::npos && c.find(ar) != string::npos) {
- vec.push_back(ar);
- tt = 1;
- break;
- }
- }
- if (tt == 0) {
- break;
- }
- }
- cout << vec[vec.size() - 1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement