#K11176. IPv4 Address Validator
IPv4 Address Validator
IPv4 Address Validator
You are given a string representing an IPv4 address. Your task is to determine whether the given string is a valid IPv4 address.
An IPv4 address consists of exactly four decimal numbers (each ranging from 0 to 255) separated by dots (.
). Any segment with leading zeros (for example, "01" instead of "1") is considered invalid, except for the single digit "0". In addition, each segment must contain only digits.
If the address is valid, output True
; otherwise, output False
.
Note: Ensure that your solution processes inputs from standard input (stdin) and writes outputs to standard output (stdout).
inputFormat
The input consists of a single line containing a string which represents the IPv4 address to be validated.
outputFormat
Output a single line: True
if the provided string is a valid IPv4 address; otherwise, output False
.
192.168.0.1
True