Universal Cup Judging System

Universal Cup

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100 Hackeable ✓
Estadísticas

Cùng với số phận trớ trêu, Nadeko có một xâu $s$ gồm các chữ cái tiếng Anh viết thường. Mong muốn tột cùng của cô là xây dựng một xâu $t$ thỏa mãn các điều kiện sau:

  • $t$ không chứa $s$ như một xâu con (không nhất thiết liên tiếp).
  • Mọi xâu con của $s$ mà không trùng với $s$ đều được chứa trong $t$ như một xâu con.

Hãy giúp cô ấy tìm xâu $t$ có độ dài nhỏ nhất có thể. Nếu có nhiều xâu như vậy, bạn được phép in ra một xâu bất kỳ.

Dữ liệu vào

Một dòng duy nhất của dữ liệu vào chứa xâu $s$ ($2 \le |s| \le 10^6$) — xâu của Nadeko. Đảm bảo rằng $s$ chỉ chứa các chữ cái viết thường.

Dữ liệu ra

Trên một dòng duy nhất, in ra một xâu $t$ bất kỳ có độ dài nhỏ nhất thỏa mãn các điều kiện của bài toán.

Ví dụ

Dữ liệu vào 1

aaaa

Dữ liệu ra 1

aaa

Dữ liệu vào 2

bba

Dữ liệu ra 2

bab

Ghi chú

Trong ví dụ thứ hai, xâu bab chứa bb, ba, a, b làm các xâu con nhưng không chứa bba. Cũng dễ thấy rằng không thể xây dựng một dãy hợp lệ có độ dài $2$, vì vậy bab là một đáp án hợp lệ.

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.