You are viewing a single comment's thread. Return to all comments →
import java.io.*; import java.util.*; import java.util.regex.Pattern ; import java.util.regex.Matcher ; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in) ; String s = in.nextLine() ; String pattern = "^[0-9]{2}(-|:|---|\\.){1}[0-9]{2}\\1[0-9]{2}\\1[0-9]{2}$" ; Pattern pat = Pattern.compile(pattern) ; Matcher matcher = pat.matcher(s) ; boolean match = matcher.find() ; if(match) { System.out.println("true") ; } else { System.out.println("false") ; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Branch Reset Groups
You are viewing a single comment's thread. Return to all comments →
\1 reference the group