fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while(t--)
  8. {
  9. string s;
  10. int k;
  11. cin >> s >> k;
  12. int n = s.size();
  13. map<char,int> m;
  14. for(int i=0;i<n;i++)
  15. {
  16. m[s[i]]++;
  17. }
  18. int sum=0;
  19. for(auto x : m)
  20. {
  21. sum = x.second;
  22. }
  23. if(n>1 && k>0 && sum!=n)
  24. {
  25. cout << "YES" << endl;
  26. }
  27. else
  28. {
  29. cout << "NO" << endl;
  30. }
  31. }
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5292KB
stdin
8
1 10000
a
3 3
rev
6 0
string
6 0
theory
9 2
universal
19 0
codeforcesecrofedoc
19 1
codeforcesecrofedoc
3 1
zzz
stdout
NO
NO
NO
NO
NO
NO
NO
NO