import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
*
*
* 查找两个数组中的公共部分
*/
public class SameString {
public static void main(String[] args) {
String s1[] = { “a”, “b”, “c” };
String s2[] = { “a”, “d”, “hh”, “b” };
String result[] = new String[s1.length + s2.length];
System.arraycopy(s1, 0, result, 0, s1.length);
System.arraycopy(s2, 0, result, s1.length, s2.length);
Arrays.sort(result);
Set<String> need = new HashSet<String>();
int times = 0;
for (int i = 0; i < result.length; i++) {
times++;
if (i+1 < result.length) {
if (result[i].equals(result[i + 1])) {
need.add(result[i]);
}
}
}
System.out.println(times);
for(String i: need){
System.out.println(i);
}
}
}