I fail to see why you make the distinction about strings. The OP is reading input on STDIN, all input will be strings, the point of the post your replying to is that there are more ways to represent an IP address in a string than just dotted decimal quads. Many IP aware applications can accept IP addresses in decimal, hex, or octal in either a single 32 bit number, or 4 dot separated 8 bit numbers (aka dotted quad)
My web browser seems perfectly happy when I pass it a string with an unsigned 32 bit integer and just as happy to get a dotted hex quad.
The OP may not care to accept any thing but decimal dotted quads, but the classic (and almost trite) saying is "Be liberal in what you accept and strict in what you emit." To not mention that there are alternate encodings that he may encounter could cause him trouble in the future.