Question: Write a Python code Given a string as input, you have to reverse the string by keeping the punctuation and spaces intact, i.e., the position

Write a Python code

Write a Python code Given a string as input, you have to

Given a string as input, you have to reverse the string by keeping the punctuation and spaces intact, i.e., the position of the punctuation and spaces should not change even after reversing, but the positions of characters, numbers will change after reversing. You have to modify the source string itself without creating another string. Input: A single line contains the input line Output: A single line in reversed order keeping the punctuation and spaces intact. Constraint: O check 1.punctuations and 2:space position. Output: noi tiso -> pecap s.2dnasnoitaut cnu p:1kceh csihtees. For example: Test Input Result 1 see this -> check 1.punctuations and 2:space position. noi tiso -> pecap s. 2dnasnoitaut cnu p: 1kceh csihtees

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!