Question: Some computer programs have problems in displaying Arabic text, especially when mixed with English words in the same line, because Arabic is written from right

Some computer programs have problems in displaying Arabic text, especially when mixed with English words in the same line, because Arabic is written from right to left and English is written from left to right. In this problem we will try to fix a text with some corrupted lines which consist of a mixture of Arabic and English words. For simplicity, all Arabic letters will be replaced with the letter '#'. Each line will contain at most one English word. For a line containing an English word, the program that will fix the text will swap the words before the English word with the words after the English word. The words before the English word will remain in the same order. The words after the English word will also remain in the same order. For example, if the line is "# ### ### abc ##, it will be fixed to become "## abc # #### ###. Sample Input/Output Output Input # ### ### abc ## ## ### ## ##### ## ### ## # xyz ## abc # #### ### ## # # # # # # # # # # xyz ## ### # # #
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
