日期:2014-05-20 浏览次数:20713 次
import java.util.Scanner;
public class Test3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String s;
String temp = "";
String input = "";
int count = 0;
int ct = 0;
Scanner scanner = new Scanner(System.in);
String s1 = scanner.next();
String s2 = scanner.next();
for (int i = 0; i < s1.length(); i++) {
for (int j = 0; j < s2.length(); j++) {
if (s1.charAt(i) == s2.charAt(j)) {
temp += s1.charAt(i);
count++;
i++;
} else {
if (count > 0) {
i--;
}
count = 0;
temp = "";
}
if (count > ct) {
ct = count;
input = temp;
if (i >= s1.length()) {
break;
}
}
}
}
System.out.println(input);
}
}