fixed the input so it reads all before giving results