CF462B Appleman and Card Game

题目描述

给你个长度为 $n$ 的字符串,要求你从这个字符串中选取 $k$ 个字符,使选到的每个字母的数量的平方和最大。

输入格式

第 $1$ 行两个整数 $n,k\space(1\le k\le n\le 10^5)$。 第 $2$ 行 $n$ 个大写字母,表示字符串。

输出格式

一个整数,表示选到的每个字母的数量的平方和。 Translated by @[busy_programmer](https://www.luogu.com.cn/user/649315)。

说明/提示

In the first test example Toastman can choose nine cards with letter D and one additional card with any letter. For each card with D he will get 9 coins and for the additional card he will get 1 coin.