Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
39 lines (30 loc) · 986 Bytes

File metadata and controls

39 lines (30 loc) · 986 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.codingTest;
import java.util.Scanner;
import java.util.regex.Pattern;
public class s2020_2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String id = sc.next();
String pw1 = sc.next();
String pw2 = sc.next();
String idExp = "[a-z0-9]{3,20}$";
String pwdExp = "[a-zA-Z0-9!@#$]{8,20}$";
Pattern patteren1 = Pattern.compile("[!@#$]");
Pattern patteren2 = Pattern.compile("[a-zA-Z]");
Pattern patteren3 = Pattern.compile("[0-9]");
boolean idchk = id.matches(idExp);
boolean pwchk4 = pw1.matches(pwdExp);
if(!idchk || !pwchk4 || !pw1.equals(pw2)) {
System.out.println("fail");
return;
}
boolean pwchk1 = patteren1.matcher(pw1).find();
boolean pwchk2 = patteren2.matcher(pw1).find();
boolean pwchk3 = patteren3.matcher(pw1).find();
if(!pwchk1 || !pwchk2 || !pwchk3){
System.out.println("fail");
return;
}
System.out.println("pass");
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.