Java implementation code:
import java.util.Scanner;
public class Practice_1009 {
public static void main(String[] args) {
String string = "";
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
boolean flag = false;
string = scanner.nextLine();
if (string.length() > 30) break;
if (string.contains(" ")) break; //判断是否有空格
if (string.equals("End of file")) break; //判断是否结束
String x[] = string.split("\\."); //将输入字符串分离为A、B、C、D形式
for (int i = 0, j = 0; i < x.length && j < x[i].length(); i++) {
char num[] = x[i].toCharArray();// convert a string to an array of characters
IF (by Character.isDigit (NUM [J])!) {
In Flag to false =;
BREAK;
}
IF (the Integer.parseInt (X [I])> 255 || the Integer.parseInt (X [I]) <0) {
In Flag to false =;
BREAK;
} the else
In Flag = to true;
}
IF (In Flag)
System.out.println ( "the Y");
the else
System.out.println ( "N");
}
}
}
still feel vegetables, but also what will not. take it easy.