Q 1116: IP Judgment
Time limit: 1Sec Memory Limit: 128MB
Title Description
In Internet-based programs, we often need to determine the legitimacy of an IP string. A legitimate IP is of the form: A.B.C.D where A, B, C, and D are all integers located in [0, 255]. For simplicity, we specify that no leading zeros are allowed to exist in these four integers, as in the case of 001. Now, please complete this judgment procedure ^_^
Input
The input consists of multiple lines, each line is a string and the input is terminated by “End of file”. The maximum string length is 30, without spaces and invisible characters.
Output
For each input, output a separate line If the string is a legitimate IP, output Y, otherwise, output N
Sample Input
|
|
Sample Output
|
|
C Code
|
|