#K711. Validate IPv4 Address
Validate IPv4 Address
Validate IPv4 Address
You are given a string representing an IPv4 address. An IPv4 address is formatted as a.b.c.d where each of a, b, c, and d is an integer in the range $0 \leq x \leq 255$. Your task is to check whether the input string is a valid IPv4 address.
Note:
- The address must consist of exactly four parts, separated by dots.
- Each part must consist of digits only, and when converted to an integer it must fall within the specified range.
- Leading zeroes are allowed (e.g., "01" is valid and considered as 1).
Output True
if the address is valid, otherwise output False
.
inputFormat
Input is read from standard input (stdin). The input consists of a single line containing the IPv4 address as a string.
outputFormat
Output to standard output (stdout) a single line: either True
if the address is valid or False
if it is not.
192.168.1.1
True
</p>