0
点赞
收藏
分享

微信扫一扫

CodeForces - 1073CodeForces - 1073A 水题一枚


A. Diverse Substring

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given a string ss, consisting of nn lowercase Latin letters.

A substring of string ss is a continuous segment of letters from ss. For example, "defor" is a substring of "codeforces" and "fors" is not.

The length of the substring is the number of letters in it.

Let's call some string of length nn diverse if and only if there is no letter to appear strictly more than n2n2 times. For example, strings "abc" and "iltlml" are diverse and strings "aab" and "zz" are not.

Your task is to find any diverse substring of string ss or report that there is none. Note that it is not required to maximize or minimize the length of the resulting substring.

Input

The first line contains a single integer nn (1≤n≤10001≤n≤1000) — the length of string ss.

The second line is the string ss, consisting of exactly nn lowercase Latin letters.

Output

Print "NO" if there is no diverse substring in the string ss.

Otherwise the first line should contain "YES". The second line should contain any diverse substring of string ss.

Examples

input

Copy


10 codeforces


output

Copy


YES code


input

Copy


5 aaaaa


output

Copy


NO


Note

The first example has lots of correct answers.

Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer.

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
using namespace std;
const double eps = 1e-8;
typedef long long LL;
const int M=105;
int n;
int main()
{
scanf("%d",&n);
string s;
cin>>s;
for(int i=0;i<n-1;i++)
{
if(s[i]!=s[i+1])
{
cout<<"YES"<<endl;
printf("%c%c",s[i],s[i+1]);
return 0;
}
}
cout<<"NO"<<endl;
return 0;
}

 

举报

相关推荐

0 条评论