Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String password = sc.nextLine();
- char[] chartocheck = {'!', '@', '#', '$', '%', '&', '*'};
- String str = password;
- String PL = password;
- String result = "";
- for(int i = 0; i < str.length(); i++){
- if (Character.isDigit(str.charAt(i))){
- result = result + str.charAt(i);
- }
- }
- if (result.length() >= (2)) {
- boolean charfound = false;
- for(int i = 0; i < password.length(); i++) {
- 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])) {
- password = password.substring(i, password.length());
- break;
- }
- }
- for(int i = 0; i < password.length(); i++) {
- 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])) {
- charfound = true;
- break;
- }
- }
- if (charfound = true) {
- if (PL.length() >= (7)) {
- System.out.println("Strong");
- } else {
- System.out.println("Weak");
- }
- } else {
- System.out.println("Weak");
- }
- } else {
- System.out.println("Weak");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement