Handle both uppercase and lowercase character inputs, and accommodate line feed in input string