Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,k,ar[1000],c=0,flag=0,count[26] = {0};
- char string[1000];
- scanf("%d %d",&n,&k);
- getchar();
- gets(string);
- while (string[c] != '\0')
- {
- if (string[c] >= 'a' && string[c] <= 'z')
- count[string[c]-'a']++;
- c++;
- }
- for (c = 0; c < 26; c++)
- {
- if(count[c] > k && n <= 2*k)
- {
- flag=1;
- }
- else if(count[c] > k && (n-count[c])<k && )
- {
- flag=1;
- }
- }
- if(flag==0)printf("YES\n");
- else printf("NO\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement