QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 15

#5880. 说外语

الإحصائيات

我们在 Google 开发出了一种可能是最好的语言,叫做 Googlerese。为了将文本翻译成 Googlerese,我们将每条消息中的每个英文字母替换为另一个英文字母。这种映射是一一对应满射的,这意味着相同的输入字母总是被替换为相同的输出字母,而不同的输入字母总是被替换为不同的输出字母。一个字母可能会被替换为它自身。空格保持不变。

例如(这里有一个提示!),我们出色的翻译算法包含以下三个映射:'a' -> 'y','o' -> 'e',以及 'z' -> 'q'。这意味着 "a zoo" 将变为 "y qee"。

Googlerese 基于一种可能是最好的替换映射,我们永远不会改变它。它在每个测试用例中都将保持不变。我们不会告诉你映射的其余部分,因为那样会使问题变得太简单,但下面的一些例子可能会有所帮助。

给定一些 Googlerese 文本,你能将其翻译回普通文本吗?

解决此问题

通常,Google Code Jam 的题目包含 1 个小规模输入和 1 个大规模输入。本题只有 1 个小规模输入。一旦你解决了小规模输入,你就完成了本题。

输入格式

输入的第一行给出了测试用例的数量 T。接下来是 T 个测试用例,每行一个。

每一行由一个 Googlerese 字符串 G 组成,由一个或多个包含 'a' - 'z' 的单词构成。连续的单词之间恰好有一个空格 (' ') 字符,且每行的开头和结尾都没有空格。

输出格式

对于每个测试用例,输出一行 "Case #X: S",其中 X 是用例编号,S 是翻译回普通文本后的字符串,该字符串在 Googlerese 中对应 G

数据范围

$1 \le T \le 30$。 G 最多包含 100 个字符。 不保证文本一定是有效的英语。

样例

输入格式 1

3
ejp mysljylc kd kxveddknmc re jsicpdrysi
rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
de kr kd eoya kw aej tysr re ujdr lkgc jv

输出格式 1

Case #1: our language is impossible to understand
Case #2: there are twenty six factorial possibilities
Case #3: so it is okay if you want to just give up

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.