Writing a function to take single line string