fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<ctype.h>
  4. int strenghtPass(char str[])
  5. {
  6. if(strlen(str)<6)
  7. return 0;
  8. int hasAlpha,hasSP,hasDigit;
  9. hasAlpha=hasSP=hasDigit=0;
  10.  
  11. for(int i=0; i<strlen(str); i++)
  12. {
  13. if(isalpha(str[i])){
  14. hasAlpha=1;}
  15. else if(isdigit(str[i])){
  16. hasDigit=1;}
  17. else if(str[i]=='*' || str[i]=='#' || str[i]=='_'){
  18. hasSP=1;}
  19. }
  20.  
  21. if(hasAlpha && hasDigit && hasSP)
  22. return 1;
  23. else if(hasAlpha && hasDigit)
  24. return 2;
  25. else if(hasAlpha)
  26. return 3;
  27. else return 0;
  28.  
  29. }
  30. int main()
  31. {
  32. char pass[50];
  33. gets(pass);
  34. int x=strenghtPass(pass);
  35. if(x==0)
  36. printf("invalid\n");
  37. else if(x==1)
  38. printf("strong\n");
  39.  
  40. else if(x==2)
  41. printf("medium\n");
  42.  
  43. else
  44. printf("week\n");
  45.  
  46.  
  47. return 0;
  48. }
  49.  
  50.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
invalid