QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 960 MB Total points: 100 Hackable ✓

#15832. Alphabet Chocolate

统计

Alice 和 Bob 决定不再给对方发送晦涩难懂的信息,而是决定分享一块巧克力。这块巧克力被分成了 $n$ 个小块,作为巧克力制造商的一个可爱噱头,每一块巧克力上都写着一个字母!

Alice 和 Bob 约定了以下协议:在拿取巧克力块之前,他们必须同时声明自己想要最左侧的还是最右侧的巧克力块。这样,他们可以确认不会发生冲突(但如果他们最终想要同一块巧克力……哎呀,他们的协议里没考虑到这一点)。

幸运的是,Alice 和 Bob 是简单且可预测的生物,他们总是会选择从同一侧获取。以下过程会一直重复,直到巧克力被吃光(或者直到他们打架):

  • Alice 说:“我想吃剩下的最左侧的那块!”而 Bob 说:“我想吃剩下的最右侧的那块!”
  • 如果他们想要的是不同的巧克力块,那么他们各自掰下自己想要的那块并吃掉。
  • 如果他们想要的是同一块巧克力,他们就会为此打架。噢,不!

请确定 Alice 和 Bob 是否会打架。如果他们会打架,请确定导致他们打架的那块巧克力上写的是什么字母。

输入格式

输入包含一行,为一个字符串 $s$,由 $n$ 个大写英文字母组成——从左到右,这些就是巧克力块上写的字母。

输出格式

如果他们不会打架,输出两个字符 :)

如果他们会打架,输出一个字母,即导致他们打架的那块巧克力上写的字母。

数据范围

  • $2 \le n \le 2 \times 10^5$
  • $s$ 仅由 $n$ 个大写英文字母组成。

样例

输入 1

ICPCMANILA

输出 1

:)

输入 2

RACECAR

输出 2

E

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.