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. Android逆向——smali复杂类解析

    i春秋作家:HAI_ 之前在Android逆向——初识smali与java类中讲解了基本的HelloWorld和简单类.这节课就要进一步深入.如果能够耐下心来分析一定会有所收获.——写给自己和后来人. ...

  2. [JavaScript] Nginx实现跨域设置

    假如跨域请求的接口为:http://xxx.cn/was5/web/search Nginx配置: 在conf/nginx.conf文件中 location / { root html; index ...

  3. 使用命令行工具npm新创建一个vue项目

    使用vue开发项目的前期工作可以参考前面写的:  Vue环境搭建及node安装过程整理 Vue.js 提供一个官方命令行工具,可用于快速搭建大型单页应用.该工具提供开箱即用的构建工具配置,带来现代化的 ...

  4. [原创]K8飞刀 新增Acunetix WVS 远程漏洞 反制黑客

    工具: K8飞刀20150603组织: K8搞基大队[K8team]作者: K8拉登哥哥博客: http://qqhack8.blog.163.com发布: 2015/6/3 20:41:29 简介: ...

  5. redis之事务

    一.是什么 可以一次执行多个命令,本质是一组命令集合.一个事务中的所有命令都会序列化,按顺序的串行化执行而不被其他命令插入,不许加塞.一个队列中,一次性.顺序性.排他性的执行一系列命令. 二.事务常用 ...

  6. python高并发?

    参考: https://yunsonbai.top/

  7. odoo开发笔记 -- 附件上传

    附件上传基本原理实现,可以参考这篇: https://www.cnblogs.com/ljwTiey/p/7348291.html http://blog.csdn.net/wangnan537/ar ...

  8. Git使用(1)

    安装git完成后 1.首先配置你的用户信息,用于体现在你的提交记录中包含your name and your email git config --global user.name "you ...

  9. JavaScript -- Document-open

    -----045-Document-open.html----- <!DOCTYPE html> <html> <head> <meta http-equiv ...

  10. spring boot实现ssm(1)功能

    前面完成了ssm的整合, 整个过程可以说很繁杂, 各种配置, 很容易让人晕掉. 这里使用spring boot 的方式来实现ssm(1)中的功能. 一. 建项目 1. 使用 idea 来创建 spri ...