For every word in the sentence , If the word starts with a vowel, encode it as the first and last letter of the word. I don't know how to do it. Any help?
Example:- Iterator to iterate on each character of the input string Output should be : Ir to ie on eh character of the it string.
maybe use slicing?
I'd split the sentence into words, and then for each word check what character it starts with. The, you can use a ternary expression to either return the first and last characters or the entire word: