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. 如何让一个input输入框居中

    <div style="text-align:center;vertical-align:middel;"><input type="text" ...

  2. sublime text syntaxdef

    http://sublimetext.info/docs/en/extensibility/syntaxdefs.html

  3. 暴破助攻提权:ruadmin

    i春秋作家:yangyangwithgnu 1 缘由 千辛万苦拿下的 webshell 不是 www-data 用户就是 networkservice 权限,要想拓展攻击面.扩大战果,提权,是必经之路 ...

  4. Python系列之——利用Python实现微博监控

    0x00 前言: 前几个星期在写一个微博监控系统 可谓是一波三折啊 获取到微博后因为一些字符编码问题 导致心态爆炸开发中断 但是就在昨天发现了另外一个微博的接口 一个手机微博的接口https://m. ...

  5. 传输层两大协议:TCP和UDP

    1. UDP 1.1 发送方式(如何发送) 面向无连接. 无状态服务. 不保证不丢失,不保证按顺序到达. 1.2 发送形式(发送的是什么) 基于数据报. 一个一个的发送,一个一个的接收. 1.3 使用 ...

  6. 移动一根火柴使等式成立js版本(递归)

    修改成递归版本 思路: 1.设定规则数组,比如:1加一根火柴只可以变成7. 2.设定方法数组,比如:一个数增加了一根火柴,其他的数必然减少一根火柴. 3.增加Array方法,由元素名和方法,得到规则对 ...

  7. C#深拷贝 反射实现

    /// <summary> /// 对象拷贝 /// </summary> /// <param name="obj">被复制对象</pa ...

  8. eclipse上搭建mybatis

    1..在help中打开 2.搜索mybatipse 3:功能简介 1:要查找某一个方法        在dao接口中某一个方法中 按住 Ctrl键 鼠标指到方法名称上 选择open xml 就会自动跳 ...

  9. 【并发】3、LockSupport阻塞与唤醒,相较与wait和notify

    我们可以使用wait和notify分别对象线程进行阻塞或者唤醒,但是我们也可以使用LockSupport实现一样的功能,并且在实际使用的时候,个人感觉LockSupport会更加顺手 范例1,wait ...

  10. POJ 2876

    #include<iostream> #include<string> using namespace std; ]; int main() { //freopen(" ...