LLPS
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
LLPS
题面翻译
题目描述
给你一个字符串 ,你要在字符串中选一些字符(一个也行),使它们组成一个回文字符串,输出可以组成的最大回文串(按字典序排)。
输入格式
一个不为空串的字符串 ,只包含小写字母,且长度不超过 。
输出格式
一个字符串,即最大回文串。
说明/提示
第一个样例“radar”中可以得到的回文串为"a", "d", "r", "aa", "rr", "ada", "rar", "rdr", "raar" and "radar",其中“rr“最大。
题目描述
This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence.
We'll call a non-empty string = ( p_{1}<p_{2}<...<p_{k} ) a subsequence of string = , where is the length of string . For example, strings "abcb", "b" and "abacaba" are subsequences of string "abacaba".
String = is lexicographically larger than string = if either > and , , ..., , or there exists such number ( r<|x| , r<|y| ) that , , ..., and x_{r+1}>y_{r+1} . Characters in the strings are compared according to their ASCII codes. For example, string "ranger" is lexicographically larger than string "racecar" and string "poster" is lexicographically larger than string "post".
String = is a palindrome if it matches string = . In other words, a string is a palindrome if it reads the same way from left to right and from right to left. For example, palindromic strings are "racecar", "refer" and "z".
输入格式
The only input line contains a non-empty string consisting of lowercase English letters only. Its length does not exceed .
输出格式
Print the lexicographically largest palindromic subsequence of string .
样例 #1
样例输入 #1
radar
样例输出 #1
rr
样例 #2
样例输入 #2
bowwowwow
样例输出 #2
wwwww
样例 #3
样例输入 #3
codeforces
样例输出 #3
s
样例 #4
样例输入 #4
mississipp
样例输出 #4
ssss
提示
Among all distinct subsequences of string "radar" the following ones are palindromes: "a", "d", "r", "aa", "rr", "ada", "rar", "rdr", "raar" and "radar". The lexicographically largest of them is "rr".
20230225-字符串的应用-随堂测验
- Status
- Done
- Rule
- Ledo
- Problem
- 6
- Start at
- 2023-2-25 10:30
- End at
- 2023-2-25 11:30
- Duration
- 1 hour(s)
- Host
- Partic.
- 34