fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool isspecial (char c) {
  5. return (c == '!' || c == '"' || c == '#' ||
  6. c == '$' || c == '%' || c == '&' ||
  7. c == '+' || c == '(' || c == ')' ||
  8. c == '*' || c == '\'');
  9. }
  10.  
  11. int main() {
  12. string password;
  13. cin >> password;
  14. bool test_lc, test_uc, test_dig, test_sp,
  15. test_len = password.length() >= 8;
  16.  
  17. test_lc = test_uc = test_dig = false;
  18. for (int i = 0; i < password.length(); i++) {
  19. if (!test_lc) test_lc = islower(password[i]);
  20. if (!test_uc) test_uc = isupper(password[i]);
  21. if (!test_dig) test_dig = isdigit(password[i]);
  22. if (!test_sp) test_sp = isspecial(password[i]);
  23. }
  24. cout << test_len + test_lc + test_uc + test_dig + test_sp;
  25. return 0;
  26. }
Success #stdin #stdout 0s 15232KB
stdin
#Abc23$$$
stdout
5