A. Generous Kefa

time limit per test:2 seconds
memory limit per test:256 megabytes
input:standard input
output:standard output

One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out all baloons to his friends. Help Kefa to find out, can he give out all his baloons, such that no one of his friens will be upset — print «YES», if he can, and «NO», otherwise. Note, that Kefa's friend will not upset, if he doesn't get baloons at all.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 100) — the number of baloons and friends.

Next line contains string s — colors of baloons.

Output

Answer to the task — «YES» or «NO» in a single line.

You can choose the case (lower or upper) for each letter arbitrary.

Examples

input

4 2
aabb

output

YES

input

6 3
aacaab

output

NO

Note

In the first sample Kefa can give 1-st and 3-rd baloon to the first friend, and 2-nd and 4-th to the second.

In the second sample Kefa needs to give to all his friends baloons of color a, but one baloon will stay, thats why answer is «NO».

 //2017-08-22
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; int main()
{
int n, k, book[];
string str;
while(cin>>n>>k){
cin>>str;
memset(book, , sizeof(book));
for(int i = ; i < n; i++)
book[str[i]-'a']++;
int maxinum = ;
for(int i = ; i < ; i++){
maxinum = max(maxinum, book[i]);
}
if(maxinum <= k)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} return ;
}

Codeforces841A的更多相关文章

  1. 【codeforces841A】Generous Kefa

    原题 A. Generous Kefatime limit per test:2 secondsmemory limit per test:256 megabytes input:standard i ...

随机推荐

  1. 拿 .properties 这种里面的数据 在不同的地方

    1 在xml中 2 在.java中 @Value("#{configProperties['key']}")    configProperties不是固定(根据配置时的id)  ...

  2. hadoop集群搭建(hdfs)

    (搭建hadoop集群的前提是服务器已成功安装jdk以及服务器之间已设置免密码登录,服务器之间的免密码登录可参考<linux服务器间ssh免密码登录>) 1.下载hadoop安装包 wge ...

  3. spring-boot集成thymeleaf。

    thymeleaf是前台页面展示,原来一直是jsp,jsp中包含很多服务器端的逻辑,逐渐淘汰.同样功能的还有freemarker.孰好孰坏不予评价,只做简单实现. 1.基本思路 (1)pom.xml中 ...

  4. 第四章 PCA降维

    目录 1. PCA降维 PCA:主成分分析(Principe conponents Analysis) 2. 维度的概念 一般认为时间的一维,而空间的维度,众说纷纭.霍金认为空间是10维的. 3. 为 ...

  5. android自定义控件 几种方式总结

    方式1:不继承任何组件 , 直接在代码里面调用实例化.public class ProgressDialog { private Dialog dialog; public ProgressDialo ...

  6. Hive中的Row_Number()使用

    语法:row_number() over (partition by 字段a order by 计算项b desc ) rank --这里rank是别名 partition by:类似hive的建表, ...

  7. 计算机网络 之 TCP协议报文结构

    前言:上学期实训课,由于要做一个网络通信的应用,期间遇到各种问题,让我深感计算机网络知识的薄弱.于是上网查找大量的资料,期间偶然发现了roc大神的博客,很喜欢他简明易懂的博文风格.本文受roc的< ...

  8. dex内存提取

    转 http://blog.csdn.net/asmcvc/article/details/18216531 智能手机的普及将移动互联网的发展推到了一个让所有人都为之兴奋的高度,我想即使是以商业眼光见 ...

  9. StreamSets学习系列之StreamSets是什么?

    不多说,直接上干货! StreamSets是一个侧重数据集成.数据加工流程构建的平台,也是一个开源的产品.通过StreamSets,用户可以方便的接入不同的数据源,并且完成数据加工流程的构建.Stea ...

  10. 【Java初探实例篇01】——Java语言基础

    示例系列,将对每节知识辅以实际代码示例,通过代码实际编写,来深入学习和巩固学习的知识点. IDE:intellij IDEA: 语言:Java 本次示例:Java语言基础知识的应用. 创建包day_4 ...