题目描述
Problem Description
Krokod enjoys playing board games with Paula. He wants to play the 7Krokods game, but Paula dislikes complex games, so Krokod decides they will only use green cards and crocodile cards.
Paula has $n$ green cards, each with one of the following letters: $d, k, o, r$.
Her total score is defined as the sum of the following parts:
- For each letter, she earns points equal to the square of the number of cards with that letter. For example, if she has $6$ cards with the letter $k$, she earns $36$ points.
- For each complete word "krokod" she forms, she earns an additional $7$ points.
Paula also has $m$ crocodile cards. She can replace any crocodile card with a green card of her choice.
Calculate the maximum score her cards can achieve.
Input Format
The first line contains two integers $n$ and $m (0 \leq n \leq 100, 0 \leq m \leq 10)$, representing the number of green cards and crocodile cards, respectively.
The second line contains a sequence of $n$ characters, where the $i$-th character represents the letter on the $i$-th green card. The sequence consists only of the characters $d, k, o, r$.
Output Format
Output a single integer, the maximum possible score for Paula.
Sample Input and Output
Sample Input #1
15 0
krokodkrokodkrk
Sample Output #1
79
Sample Input #2
5 1
rokod
Sample Output #2
17
Sample Input #3
8 2
ddkkoorr
Sample Output #3
35
Notes
Explanation for Sample #1
Paula has $2$ letters $d$ ($2 \times 2 = 4$ points), $6$ letters $k$ ($6 \times 6 = 36$ points), $4$ letters $o$ ($4 \times 4 = 16$ points), and $3$ letters $r$ ($3 \times 3 = 9$ points). The word "krokod" can be spelled $2$ times ($7 \times 2 = 14$ points). Her total score is $79$ ($4 + 36 + 16 + 9 + 14 = 79$).
Explanation for Sample #2
Paula can replace her crocodile card with a green card with the letter $k$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分