Closed MuhammadTausif closed 6 hours ago
Link
Difficulty: Easy
Given a String str, reverse the string without reversing its individual words. Words are separated by dots.
Note: The last character has not been '.'.
Input: str = i.like.this.program.very.much Output: much.very.program.this.like.i Explanation: After reversing the whole string(not individual words), the input string becomes much.very.program.this.like.i Input: str = pqr.mno Output: mno.pqr Explanation: After reversing the whole string , the input string becomes mno.pqr
Constraints:
def reverseWords(self,str): # code here s = str.split('.') new_s = s[::-1] return ".".join(new_s)
Reverse Words
Link
Difficulty: Easy
Given a String str, reverse the string without reversing its individual words. Words are separated by dots.
Note: The last character has not been '.'.
Examples :
Constraints: