Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package javaapplication1;
- import java.util.*;
- import java.*;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.PrintWriter;
- import java.io.File;
- import java.lang.String;
- import java.util.regex.*;
- public class Main {
- public static void main(String[] args) throws Exception{
- Scanner in = new Scanner(new FileReader("input.txt"));
- PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
- String s = in.nextLine();
- //[0-9]{1,2}|1[0-9]{2}|25[0-6]{1}|2[0-4]{1}[0-9]{1}[\\u002E]{1}
- String mask = "[0]{0,170}([0-9]{1,2}|1[0-9]{2}|25[0-5]{1}|2[0-4]{1}[0-9]{1})";
- Pattern p = Pattern.compile(mask + "[\\u002E]{1}" + mask + "[\\u002E]{1}" + mask + "[\\u002E]{1}" + mask );
- Matcher tmp = p.matcher(s);
- if(!tmp.matches() )
- System.out.println(0);
- else
- System.out.println(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement