Python Forum
Write a code to output in alphabetical order - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Write a code to output in alphabetical order (/thread-7661.html)



Write a code to output in alphabetical order - AbdelaliPython - Jan-19-2018

hi all i'm new here , i have a problem with my homework here if you can help me to solve it !

Assume s is a string of lower case characters.

Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your program should print

Longest substring in alphabetical order is: beggh

In the case of ties, print the first substring. For example, if s = 'abcbcd', then your program should print

Longest substring in alphabetical order is: abc


RE: Write a code to output in alphabetical order - j.crater - Jan-19-2018

Hi, do you have an attempt/code that you can share with us so we can help you find mistakes in it?
If not, have you devised an algorithm or pseudo code for tackling the problem?