CF90B.African Crossword
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An African crossword is a rectangular table n × 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.
非洲填字游戏是一个大小为 n×m 的矩形表格。表格的每个单元格中恰好包含一个字母。该表格(也称为网格)中包含某个需要解密的单词。
要解出该填字游戏,你需要划掉所有在行和列中重复出现的字母。换言之,当且仅当对应行或列中至少还存在另一个完全相同的字母时,该字母才应被划掉。此外,所有满足条件的字母需同时被划掉。
当所有重复字母均被划掉后,我们将剩余的字母按字符串形式写出:位置较高的字母排在位置较低的字母之前;若字母位于同一行,则左侧的字母排在右侧的字母之前。由此得到的字符串即为本题的答案。
请你解出该非洲填字游戏,并输出其中所加密的单词。
输入格式
The first line contains two integers n and m (1 ≤ n, m ≤ 100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.
第一行包含两个整数 n 和 m(1≤n,m≤100)。接下来的 n 行,每行包含 m 个小写拉丁字母,即填字游戏的网格。
输出格式
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
输入解题思路,AI测评打分。不知道怎么写?