Given some data in a text file, the task is to scramble the textand output in a separate text file. So, we need to write a Pythonprogram that reads a text file, scrambles the words in the file andwrites the output to a new text file.
Rules to be followed:
- Words less than or equal to 3 characters need not bescrambled.
- Don’t scramble first and last char, so Scrambling canbecome Srbmnacilg or Srbmnailcg orSnmbracilg, i.e. letters except first and last can bescrambled in any order.
- Punctuation at the end of the word to be maintained as is i.e.“Surprising, ” could become “Spsirnirug, ” but not “Spsirn,irug”