{"id":14018,"date":"2021-10-01T10:00:57","date_gmt":"2021-10-01T04:30:57","guid":{"rendered":"https:\/\/python-programs.com\/?p=14018"},"modified":"2021-11-22T18:33:29","modified_gmt":"2021-11-22T13:03:29","slug":"python-program-to-rearrange-the-letters-of-a-string-in-alphabetical-order","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-rearrange-the-letters-of-a-string-in-alphabetical-order\/","title":{"rendered":"Python Program to Rearrange the Letters of a String in Alphabetical Order"},"content":{"rendered":"

Given a string, the task is to rearrange the letters of a string in Alphabetical order in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string = btechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

The original string is [ btechgeeks ]\r\nThe modified string after reordering the letters of a string alphabetically is [ bceeeghkst ]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string =Good morning this is BTechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

Enter some random string = Good morning this is BTechgeeks\r\nThe original string is [ Good morning this is BTechgeeks ]\r\nThe modified string after reordering the letters of a string alphabetically is [ BGTcdeeegghhiiikmnnooorssst ]<\/pre>\n

Program to Rearrange the Letters of a String in Alphabetical Order in Python<\/h2>\n

Below are the ways to rearrange the letters of a string in Alphabetical order in Python.<\/p>\n