QOJ.ac

QOJ

Time Limit: 4.0 s Memory Limit: 512 MB Total points: 100

#17614. الحذف

Statistics

لتكن لدينا كلمة $w$، وهي سلسلة من $n$ أحرف إنجليزية صغيرة. لموضعين معطيين، أي عددين صحيحين موجبين $a$ و$b$ يحققان $1 \le a \le b \le n$، نعرّف السلسلة الفرعية $w_{a,b}$ بأنها الكلمة الناتجة عن أخذ جميع المحارف بالترتيب من الموضع $a$ حتى الموضع $b$ في الكلمة $w$. ونعرّف أيضًا الباقي $o_{a,b}$ بأنه الكلمة الناتجة عن حذف جميع المحارف من الموضع $a$ حتى الموضع $b$ من الكلمة $w$.

أوجد طول أطول سلسلة فرعية $w_{a,b}$ بحيث يحتوي الباقي $o_{a,b}$ أيضًا على $w_{a,b}$ كسلسلة فرعية.

الإدخال

يحتوي السطر الأول على الكلمة المعطاة $w$، وهي سلسلة من أحرف إنجليزية صغيرة.

الإخراج

اطبع أكبر طول ممكن مطلوب.

المهام الفرعية

ليكن $n$ طول الكلمة المعطاة.

المهمة الفرعية النقاط القيود
$1$ $16$ $1 \le n \le 400$
$2$ $24$ $401 \le n \le 5\,000$
$3$ $60$ $5001 \le n \le 100\,000$

أمثلة

الإدخال 1

abcxyzabc

الإخراج 1

3

الإدخال 2

bbcdbcbbcbadadda

الإخراج 2

5

ملاحظة

شرح المثال الثاني: bbcdbcbbcbadadda $\to$ bbcdbcbadda

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.