题干:

This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.

You are given string s consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence.

We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk (1  ≤  p1 < p2 < ... < pk  ≤ |s|) a subsequence of string s = s1s2... s|s|, where |s| is the length of string s. For example, strings "abcb", "b" and "abacaba" are subsequences of string "abacaba".

String x = x1x2... x|x| is lexicographically larger than string y = y1y2... y|y| if either |x| > |y| and x1 = y1, x2 = y2, ..., x|y| = y|y|, or there exists such number r (r < |x|, r < |y|) that x1 = y1, x2 = y2, ..., xr = yr and xr  +  1 > yr  +  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 s = s1s2... s|s| is a palindrome if it matches string rev(s) = s|s|s|s| - 1... s1. 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".

Input

The only input line contains a non-empty string s consisting of lowercase English letters only. Its length does not exceed 10.

Output

Print the lexicographically largest palindromic subsequence of string s.

Examples

Input

radar

Output

rr

Input

bowwowwow

Output

wwwww

Input

codeforces

Output

s

Input

mississipp

Output

ssss

Note

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".

题目大意:

   给你一个字符串,让你找到字典序最大的回文子序列。(给出了字典序的定义和子序列的定义)

解题报告:

   因为数据量是10,本来想写搜索,但是看了眼样例,发现一个小规律,答案都是相同的字符,那么结论就出来了,,,找到ASCII最大的那个字符,输出个数就可以了。

  证明可以用样例,,,你就算是选了一些比较大的回文串比如abzcczba,那么完全可以用其中最大的那个字符z来打头。于是我们证明了一定用最大的那个字符打头,那么我们假设字符串zaaz,那么完全可以直接取zz,于是得出结论。。

AC代码:

#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
//string s[5000],str;
//int len;
//int top;
//bool fit(string ss) {
//	int l = ss.length();
//	if(l == 0) return 0;
//	for(int i = 0; i<l/2; i++) {
//		if(ss[i] != ss[l-i]) return  0 ;
//	}
//	return 1;
//}
//void dfs(int cur,string tmp) {
//	if(cur >= len) return ;
//	if(fit(tmp)) s[++top] = tmp;
//	dfs(cur+1,tmp+str[cur+1]);
//	dfs(cur+1,tmp);
//}
int main()
{
	string str;
	cin>>str;
	int len = str.length();
//	string w = string(1,str[0]);
//	dfs(0,w);
//	printf("%d\n",top);
//	for(int i = 1; i<=top; i++) {
//		cout << s[i] << endl;
//	}
	char cur = 0;
	for(int i = 0; i<len; i++) {
		if(str[i] > cur) cur = str[i];
	}
	int cnt = 0;
	for(int i = 0; i<len; i++) {
		if(str[i] == cur) cnt++;
	}
	for(int i = 1; i<=cnt; i++) {
		putchar(cur);
	}
	return 0 ;
 }

(话说代码里那个搜索不太对好像,,,也没debug)