We should be able to use this application with different text source. To do that
we should make sure that os.Stdin file descriptor points to a pipe. For this
purpose we should get os.FileInfo metadata for the standard input:

info, _ := os.Stdin.Stat()

The Stat function returns a os.FileInfo object that keeps information about
the file mode and file size. We should validate that the os.Stdin is not a
character device.

You can check whether there is a content to read from by comparing info.Size().

Note: Character devices in Linux/Unix are unbuffered devices that have direct
access to underlying hardware. They do not necessarily allow you to read or
write single character at a time. Example: audio or graphics cards,
or input devices like keyboard and mouse.