Universal Cup Judging System

Universal Cup

时间限制: 1.0 s 内存限制: 256 MB 总分: 100 可 Hack ✓
统计

数奇な運命とともに、Nadeko は英小文字からなる文字列 $s$ を持っています。彼女の究極の願いは、以下の条件を満たす文字列 $t$ を構築することです:

  • $t$ は $s$ を部分列として含まない。
  • $s$ と一致しない $s$ のすべての部分列は、$t$ に部分列として含まれる。

可能な限り長さが最小となる文字列 $t$ を見つけるのを手伝ってください。そのような文字列が複数存在する場合は、どれを出力しても構いません。

入力

入力の唯一の行には、Nadeko の文字列 $s$($2 \le |s| \le 10^6$)が与えられます。$s$ は英小文字のみからなることが保証されます。

出力

問題の条件を満たす最小の長さの文字列 $t$ を $1$ 行に出力してください。

入出力例

入力 1

aaaa

出力 1

aaa

入力 2

bba

出力 2

bab

注記

2 番目の例では、文字列 bab は部分列として bb、ba、a、b を含みますが、bba は含みません。また、長さ $2$ の正しい文字列を構築することが不可能なのは明らかであるため、bab は正しい答えの一つです。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#367EditorialOpen题解jianglyView

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.