CF335B.Palindrome

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Given a string ss , determine if it contains any palindrome of length exactly 100100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of ss and is as long as possible.

输入格式

The only line of the input contains one string ss of length nn ( 1<=n<=51041<=n<=5·10^{4} ) containing only lowercase English letters.

输出格式

If ss contains a palindrome of length exactly 100100 as a subsequence, print any palindrome of length 100100 which is a subsequence of ss . If ss doesn't contain any palindromes of length exactly 100100 , print a palindrome that is a subsequence of ss and is as long as possible.

If there exists multiple answers, you are allowed to print any of them.

输入输出样例

  • 输入#1

    bbbabcbbb
    

    输出#1

    bbbcbbb
    
  • 输入#2

    rquwmzexectvnbanemsmdufrg
    

    输出#2

    rumenanemur
    

说明/提示

A subsequence of a string is a string that can be derived from it by deleting some characters without changing the order of the remaining characters. A palindrome is a string that reads the same forward or backward.

首页