Advertisement
Guest User

CF A

a guest
Aug 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. string a;
  7. map<char,int>cnt;
  8. map<char,int>:: iterator I;
  9.  
  10. int i,l,n,m,res=0,f=0;
  11. cin>>m>>n;
  12. cin>>a;
  13. for(i=0; i<m; i++)
  14. {
  15. cnt[a[i]]++;
  16. }
  17.  
  18. for(I=cnt.begin(); I!=cnt.end(); I++)
  19. {
  20. if(I->second>n)
  21. f=1;
  22.  
  23.  
  24. }
  25. if(f==0)
  26. cout<<"YES"<<endl;
  27. else
  28. cout<<"NO"<<endl;
  29.  
  30.  
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement