I am trying to find the words that start with a particular letter from a list of strings. The user will input the list of words and the starting letter. For example, something like:
"table pencil chair desk pen" "p"
So the words that start with p
should be displayed, in this case pen
and pencil
. My first step is to split the string into a list of strings using the words
function. Then how do I find what letter each word starts with? The type of the function will look like:
--------------Find words Starting with a given letter------------------
findWords :: String -> Char -> [String]