CF90B.African Crossword

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

An African crossword is a rectangular table n×mn×m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.

To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.

When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.

You are suggested to solve an African crossword and print the word encrypted there.

输入格式

The first line contains two integers nn and mm ( 1<=n,m<=1001<=n,m<=100 ). Next nn lines contain mm lowercase Latin letters each. That is the crossword grid.

输出格式

Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.

输入输出样例

  • 输入#1

    3 3
    cba
    bcd
    cbc
    

    输出#1

    abcd
  • 输入#2

    5 5
    fcofd
    ooedo
    afaoa
    rdcdf
    eofsf
    

    输出#2

    codeforces
首页