import java.util.*;
import java.util.stream.*;
public class IntersectStrings {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String a = in.nextLine();
String b = in.nextLine();
System.out.println( a.chars()
.distinct()
.mapToObj(c -> (char) c)
.filter(c -> b.indexOf(c) >= 0)
.sorted()
.map(c -> c.toString())
.collect(Collectors.joining(", "))
);
}
}