import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
public class HelloWorld {
public static void main(String[] args) throws IOException {
while (true) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
System.out.println(IPVerify(str));
}
}
public static boolean isDouble(String str) {
Pattern pattern = Pattern.compile("^\\d+(\\.\\d+)?$");
boolean bool = pattern.matcher(str).matches();
System.out.println("compiled: " + str);
return bool;
}
public static boolean dateVerify(String str) {
boolean isData = false;
final String date_regexp = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?"
+ "((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|"
+ "(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?"
+ "((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))"
+ "[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))"
+ "|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?"
+ "((0?[1-9])|(1[0-9])|(2[0-8]))))))";// 匹配日期
Pattern pattern = Pattern.compile(date_regexp);
isData = pattern.matcher(str).matches();
return isData;
}
public static boolean intVerify(String str) {
boolean isInt = false;
final String non_negative_integers_regexp = "^\\d+$";
Pattern pattern = Pattern.compile(non_negative_integers_regexp);
isInt = pattern.matcher(str).matches();
return isInt;
}
public static boolean timeVerify(String str) {
boolean isTime = false;
final String time_regexp = "^((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))?$";
Pattern pattern = Pattern.compile(time_regexp);
isTime = pattern.matcher(str).matches();
return isTime;
}
public static boolean IPVerify(String str) {
boolean isTime = false;
final String time_regexp = "^([1-9]|[1-9]\\d|1\\d{2}|2[0-1]\\d|22[0-3])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$";
Pattern pattern = Pattern.compile(time_regexp);
isTime = pattern.matcher(str).matches();
return isTime;
}
}