Language: C++

#include <iostream>
#include <cmath>                                                                                                                                                                                                    using namespace std;                                                                                                                                                                                                                                                                                                                                                                                                                    int main() {                                                                                                                                                                                                            string s, t;                                                                                                                                                                                                        cin >> s;                                                                                                                                                                                                           cin >> t;                                                                                                                                                                                                           int l = t.length();
    int max = 0;
    for(int ts=t.length(); ts>0; ts--) {
        for(int k = 0; k<t.length() - ts + 1; k++) {
            string dsub = t.substr(k, ts);
            if(s.find(dsub) != std::string::npos) {
                cout << t.length() - ts << '\n';
                return 0;
            }
        }
    }
    cout << t.length() << '\n';
    return 0;                                                                                                                                                                                                       }

Compiler output:
a.cc:2:213: warning: extra tokens at end of #include directive
    2 | #include <cmath>                                                                                                                                                                                                    using namespace std;                                                                                                                                                                                                                                                                                                                                                                                                                    int main() {                                                                                                                                                                                                            string s, t;                                                                                                                                                                                                        cin >> s;                                                                                                                                                                                                           cin >> t;                                                                                                                                                                                                           int l = t.length();
      |                                                                                                                                                                                                                     ^~~~~
a.cc:3:5: error: expected unqualified-id before 'for'
    3 |     int max = 0;
      |     ^~~
a.cc:3:28: error: 'ts' does not name a type; did you mean 'tm'?
    3 |     int max = 0;
      |                            ^ 
      |                            tm
a.cc:3:34: error: 'ts' does not name a type; did you mean 'tm'?
    3 |     int max = 0;
      |                                  ^ 
      |                                  tm
a.cc:12:5: error: 'cout' does not name a type
   12 |     }
      |     ^   
a.cc:13:5: error: expected unqualified-id before 'return'
   13 |     cout << t.length() << '\n';
      |     ^~~~~~
a.cc:13:213: error: expected declaration before '}' token
   13 |     cout << t.length() << '\n';
      |                                                                                                                                                                                                                     ^