Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- string s;
- int k, odds;
- int cnt[5000];
- main() {
- cin >> s >> k;
- int n = s.size();
- for(int i = 0; i < s.size(); i++)
- cnt[s[i] - 'a']++;
- for(int i = 0; i < 26; i++)
- odds += cnt[i]%2;
- if(odds <= k + 1)
- cout << "YES\n";
- else cout << "NO\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement