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(System.in);
- // Scanner in = new Scanner(new FileReader("input.txt"));
- // PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
- String s = in.nextLine();
- Pattern p = Pattern.compile("[0]{0,170}([0-9]{1,2}|1[0-9]{2}|25[0-5]{1}|2[0-4]{1}[0-9]{1})[\\.]{1}[0]{0,170}([0-9]{1,2}|1[0-9]{2}|25[0-5]{1}|2[0-4]{1}[0-9]{1})[\\.]{1}[0]{0,170}([0-9]{1,2}|1[0-9]{2}|25[0-5]{1}|2[0-4]{1}[0-9]{1})[\\.]{1}[0]{0,170}([0-9]{1,2}|1[0-9]{2}|25[0-5]{1}|2[0-4]{1}[0-9]{1})");
- if(!p.matcher(s).matches() )
- System.out.println(0);
- else
- System.out.println(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement