fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. using namespace std;
  5.  
  6. int main(){
  7. bool big, small, nums, others, ASCII;
  8.  
  9. big = false;
  10. ASCII = true;
  11. small = false;
  12. nums = false;
  13. others = false;
  14.  
  15. int res = 0;
  16.  
  17. string a;
  18. cin >> a;
  19.  
  20. for(unsigned int i = 0; i<a.size(); i++){
  21. if (a[i] < 33 || a[i] > 126){
  22. ASCII = false;
  23. }
  24. if(!isalnum(a[i]) && others == false){
  25. others = true;
  26. res++;
  27. }
  28. else if (isalpha(a[i]) == true && (small == false || big == false)){
  29. if(islower(a[i])){
  30. small = true;
  31. res++;
  32. }
  33. else if(isupper(a[i])){
  34. big = true;
  35. res++;
  36. }
  37. }
  38. else if(isdigit(a[i]) && nums == false){
  39. nums = true;
  40. res++;
  41. }
  42. }
  43. if(a.size()>7 && a.size()<15 && res >= 3 && ASCII){
  44. cout << "YES" << endl;
  45. }
  46. else{
  47. cout << "NO" << endl;
  48. }
  49. }
Success #stdin #stdout 0.01s 5324KB
stdin
VASYA123
stdout
NO