Advertisement
Guest User

123

a guest
Feb 9th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5.  
  6. Scanner sc = new Scanner(System.in);
  7. String password = sc.nextLine();
  8.  
  9. char[] chartocheck = {'!', '@', '#', '$', '%', '&', '*'};
  10. String str = password;
  11. String PL = password;
  12. String result = "";
  13.  
  14. for(int i = 0; i < str.length(); i++){
  15. if (Character.isDigit(str.charAt(i))){
  16. result = result + str.charAt(i);
  17. }
  18. }
  19.  
  20.  
  21.  
  22. if (result.length() >= (2)) {
  23. boolean charfound = false;
  24.  
  25. for(int i = 0; i < password.length(); i++) {
  26. if ((password.charAt(i) == chartocheck[0]) || (password.charAt(i) == chartocheck[1]) || (password.charAt(i) == chartocheck[2]) || (password.charAt(i) == chartocheck[3]) || (password.charAt(i) == chartocheck[4]) || (password.charAt(i) == chartocheck[5]) || (password.charAt(i) == chartocheck[6])) {
  27. password = password.substring(i, password.length());
  28. break;
  29. }
  30. }
  31.  
  32. for(int i = 0; i < password.length(); i++) {
  33. if ((password.charAt(i) == chartocheck[0]) || (password.charAt(i) == chartocheck[1]) || (password.charAt(i) == chartocheck[2]) || (password.charAt(i) == chartocheck[3]) || (password.charAt(i) == chartocheck[4]) || (password.charAt(i) == chartocheck[5]) || (password.charAt(i) == chartocheck[6])) {
  34. charfound = true;
  35. break;
  36. }
  37. }
  38.  
  39.  
  40.  
  41. if (charfound = true) {
  42. if (PL.length() >= (7)) {
  43. System.out.println("Strong");
  44. } else {
  45. System.out.println("Weak");
  46. }
  47.  
  48. } else {
  49. System.out.println("Weak");
  50. }
  51. } else {
  52. System.out.println("Weak");
  53. }
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement