Small fixes. The main fix is that output must be in UTF-8, and interaction with user was changed(now we wait, when user will enter all lines)