Question: Write a python code that takes a string as an user input and finds out all the duplicate characters and makes consecutive substrings with the

Write a python code that takes a string as an user input and finds out all the duplicate characters and makes consecutive substrings with the duplicates found in the given string and appends in a list. Sort the list in ascending order and print as output. If you find ONLY one shortest substring print that too, otherwise print the number of shortest substrings. You should handle every uppercase and lowercase character and exclude the spaces.. [You can not use sort() or sorted(), min() function here.] ================================================ Sample Input 01: It is a rainy day
Sample Output 01: new_list = ['aaa', 'iii', 'yy'] shortest = yy
Explanation 01: Substrings of duplicate characters of the given string are 'iii', 'aaa' and 'yy'. Sorting them in ascending order and the shortest substring is 'yy' ================================================ Sample Input 02: Programming is not fun
Sample Output 02: new_list = ['gg', 'ii', 'mm', 'nnn', 'oo', 'rr']
shortest = 5
Explanation 02: Substrings of duplicate characters of the given string are 'rr', 'oo', 'gg', 'mm', 'ii', 'nnn'. Sort them in ascending order and there are multiple shortest substring available thats why printing the total number of shortest substring.
Question-1: Write a python code that takes a string as an user input and finds out all the duplicate characters and makes consecutive substrings with the duplicates found in the given string and appends in a list. Sort the list in ascending order and print as output. If you find ONLY one shortest substring print that too, otherwise print the number of shortest substrings. You should handle every uppercase and lowercase character and exclude the spaces.. [You can not use sort or sorted().min() function here] Sample Input 01: It is a rainy day Sample Output 01: new_list = ['aaa', '. Wy] shortest = yy Explanation 01: Substrings of duplicate characters of the given string are ii', 'aaa' and yy. Sorting them in ascending order and the shortest substring is 'yy Sample Input 02: Programming is not fun Sample Output 02 new_list = ['99', 'mm'. nnn', 'o', 'r'] shortest = 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
