• [1290] Which Lottery Tickets Should We Buy

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Mr. Cai and TT wanted to be rich, they decided to buy some lottery tickets, but here comes the question, Mr. Cai wanted this one but TT wanted that one. After a quarrel, Mr. Cai came up with a good idea, everyone wrote a series of numbers, then calculated the common numbers and mixed numbers, that would be the numbers they would buy, but they did not konw how to deal with so many groups of cases, can you help them?


  • 输入
  • There are many cases. Firstly there are two integers n and m (1 <= n, m <= 100),means the number of Mr. Cai and TT's number. Next two line include n and m numbers,Ni Mi (0 < Ni, Mi <= 100) means Mr. Cai's numbers and TT's numbers.
  • 输出
  • For each cases, output two lines, first line output the common numbers,next line output the mixed numbers. If there is no common number, output"All different" in a single line. To lower the difficulty, output form has changed, pay attention! Print by ascending order.
  • 样例输入
  • 3 2
    1 2 4
    2 3
  • 样例输出
  • 2 
    1 2 3 4 
  • 提示
  • 来源
  • Mr. Cai
  • 操作

显示春菜