>>931
https://paiza.io/projects/YTmp_QaHw0hpHqxX4cBGKw
入力
A B
C D
A C

出力
A B C
C D

期待される出力
A B C D

じゃろ?