Medium Accuracy: 59.74%
Submissions: 8300 Points: 4
Given a String. Reverse each word in it where the words are separated by dots.
S = "i.like.this.program.very.much"
Explanation: The words "i", "like",
"this", "program", "very", "much"
are all reversed.
S = "pqr.mno"
Explanation: Both "pqr" and "mno" are
You don't need to read input or print anything. Your task is to complete the function reverseWords() which takes the string S as input and returns the resultant string by reversing all the words separated by dots.
Expected Time Complexity: O(|S|). Expected Auxiliary Space: O(|S|).