No.145 yukiover
タグ : / 解いたユーザー数 101
作問者 :
sugim48
Problem Statement
There are $N$ panels lined up on a desk.
Each panel has a lowercase letter written on it.
You rearrange the panels into several rows, forming a string corresponding to each row.
For each row, if its string is lexicographically greater than yuki, you gain $1$ happiness.
What is the maximum happiness you can obtain?
Input
$N$ $S$
The first line contains an integer $N\ (1\le N\le10^5)$, the number of panels.
The second line contains a string $S$ consisting of $N$ lowercase letters.
The $i$-th panel has the $i$-th character of $S$ written on it.
Output
Output the maximum happiness.
Sample
Sample 1
Input
3 xyz
Output
2
If you form the strings yx and z, both are lexicographically greater than yuki.
Sample 2
Input
4 yuki
Output
0
yuki is lexicographically equal to yuki, so no happiness is gained.
Sample 3
Input
3 zzz
Output
3
You may form any number of identical strings.
Sample 4
Input
11 kyuukyuusya
Output
3
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。