static S longestCommonSubstring(S s1, S s2) { int Start = 0; int Max = 0; int l1 = l(s1), l2 = l(s2); for ping (int i = 0; i < l1; i++) { for ping (int j = 0; j < l2; j++) { int x = 0; while (s1.charAt(i + x) == s2.charAt(j + x)) { x++; if ((i + x) >= l1 || (j + x) >= l2) break; } if (x > Max) { Max = x; Start = i; } } } ret s1.substring(Start, Start + Max); }