Universal Cup Judging System

Universal Cup

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

Insieme a un destino contorto, Nadeko ha una stringa $s$ composta da lettere minuscole. Il suo desiderio supremo è costruire una stringa $t$ per la quale valgano le seguenti condizioni:

  • $t$ non contiene $s$ come sottosequenza.
  • Ogni sottosequenza di $s$ che non coincide con $s$ è contenuta in $t$ come sottosequenza.

Aiutala a trovare una stringa $t$ della minima lunghezza possibile. Se esistono più stringhe di questo tipo, puoi stamparne una qualsiasi.

Input

Un'unica riga dell'input contiene la stringa $s$ ($2 \le |s| \le 10^6$) — la stringa di Nadeko. È garantito che $s$ contenga solo lettere minuscole.

Output

In una singola riga, stampa una qualsiasi stringa $t$ di lunghezza minima che soddisfi le condizioni del problema.

Esempi

Input 1

aaaa

Output 1

aaa

Input 2

bba

Output 2

bab

Note

Nel secondo esempio, la stringa bab contiene bb, ba, a, b come sottosequenze ma non contiene bba. È anche ovvio che è impossibile costruire una sequenza corretta di lunghezza $2$, quindi bab è una risposta possibile.

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.