{"problem":{"name":"B. African Crossword","description":{"content":"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 t","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF90B"},"statements":[{"statement_type":"Markdown","content":"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.\n\nTo 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.\n\nWhen 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.\n\nYou are suggested to solve an African crossword and print the word encrypted there.\n\n## Input\n\nThe 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\n## Output\n\nPrint the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"非洲填字游戏是一个大小为 $n × m$ 的矩形表格。表格中的每个单元格恰好包含一个字母。该表格（也称为网格）包含一个需要解密的加密单词。\n\n要解谜该填字游戏，你需要划掉所有在行和列中重复出现的字母。换句话说，一个字母只有在对应的行或列中至少还有一个与之完全相同的字母时，才被划掉。此外，所有这样的字母将同时被划掉。\n\n当所有重复的字母都被划掉后，我们将剩余的字母按顺序写成一个字符串。位置较高的字母排在位置较低的字母之前；如果字母在同一行中，则靠左的字母优先。由此得到的单词即为问题的答案。\n\n请你解出这个非洲填字游戏，并打印出其中加密的单词。\n\n第一行包含两个整数 $n$ 和 $m$（$1 ≤ n, m ≤ 100$）。接下来的 $n$ 行每行包含 $m$ 个小写拉丁字母，即填字游戏的网格。\n\n请在一行中打印出加密的单词。保证答案至少包含一个字母。\n\n## Input\n\n第一行包含两个整数 $n$ 和 $m$（$1 ≤ n, m ≤ 100$）。接下来的 $n$ 行每行包含 $m$ 个小写拉丁字母，即填字游戏的网格。\n\n## Output\n\n请在一行中打印出加密的单词。保证答案至少包含一个字母。\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"Let $ G $ be an $ n \\times m $ matrix over the alphabet $ \\Sigma $ (lowercase Latin letters), where $ G[i][j] $ denotes the letter at row $ i $, column $ j $.\n\nDefine:\n- For each cell $ (i, j) $, let $ r_i $ be the multiset of letters in row $ i $:  \n  $ r_i = \\{ G[i][k] \\mid 0 \\leq k < m \\} $\n- Let $ c_j $ be the multiset of letters in column $ j $:  \n  $ c_j = \\{ G[k][j] \\mid 0 \\leq k < n \\} $\n\nA letter at position $ (i, j) $ is **crossed out** if and only if:  \n$ \\text{count}_{r_i}(G[i][j]) > 1 $ or $ \\text{count}_{c_j}(G[i][j]) > 1 $\n\nLet $ R \\subseteq \\{0, \\dots, n-1\\} \\times \\{0, \\dots, m-1\\} $ be the set of **remaining** (uncrossed) cells:  \n$ R = \\{ (i, j) \\mid \\text{count}_{r_i}(G[i][j]) = 1 \\text{ and } \\text{count}_{c_j}(G[i][j]) = 1 \\} $\n\nThe encrypted word is formed by reading the letters in $ R $ in **row-major order**:  \nFor $ i = 0 $ to $ n-1 $, and for each $ i $, for $ j = 0 $ to $ m-1 $, include $ G[i][j] $ in the output if $ (i, j) \\in R $.\n\nOutput the concatenation of all such $ G[i][j] $ for $ (i, j) \\in R $, in row-major order.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF90B","tags":["implementation","strings"],"sample_group":[["3 3\ncba\nbcd\ncbc","abcd"],["5 5\nfcofd\nooedo\nafaoa\nrdcdf\neofsf","codeforces"]],"created_at":"2026-03-03 11:00:39"}}