2017-02-24 00:24:47 -06:00
|
|
|
// Author: Rodney Shaghoulian
|
2018-07-27 16:45:56 -07:00
|
|
|
// Github: github.com/RodneyShag
|
|
|
|
|
// HackerRank: hackerrank.com/RodneyShag
|
2017-02-24 00:24:47 -06:00
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
public class Main{
|
|
|
|
|
|
|
|
|
|
static Iterator func(ArrayList mylist){
|
|
|
|
|
Iterator it=mylist.iterator();
|
|
|
|
|
while(it.hasNext()){
|
|
|
|
|
Object element = it.next();
|
|
|
|
|
if (element.equals("###"))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return it;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@SuppressWarnings({ "unchecked" })
|
|
|
|
|
public static void main(String []args){
|
|
|
|
|
ArrayList mylist = new ArrayList();
|
|
|
|
|
Scanner sc = new Scanner(System.in);
|
|
|
|
|
int n = sc.nextInt();
|
|
|
|
|
int m = sc.nextInt();
|
|
|
|
|
for(int i = 0;i<n;i++){
|
|
|
|
|
mylist.add(sc.nextInt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mylist.add("###");
|
|
|
|
|
for(int i=0;i<m;i++){
|
|
|
|
|
mylist.add(sc.next());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Iterator it=func(mylist);
|
|
|
|
|
while(it.hasNext()){
|
|
|
|
|
Object element = it.next();
|
|
|
|
|
System.out.println((String)element);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|