Advertisement
Arch_of_Triumph

Untitled

Sep 27th, 2023
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. string s;
  6. int k, odds;
  7. int cnt[5000];
  8. main() {
  9.     cin >> s >> k;
  10.     int n = s.size();
  11.     for(int i = 0; i < s.size(); i++)
  12.         cnt[s[i] - 'a']++;
  13.     for(int i = 0; i < 26; i++)
  14.         odds += cnt[i]%2;                
  15.     if(odds <= k + 1)
  16.         cout << "YES\n";        
  17.     else cout << "NO\n";
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement