Python Forum
Write a code to output in alphabetical order
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a code to output in alphabetical order
#1
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
Reply
#2
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to write a dict code in python ariellea88 4 913 Oct-31-2023, 08:45 AM
Last Post: buran
  No desired output for code. James349 1 933 May-19-2023, 05:43 PM
Last Post: deanhystad
  Padlock of alphabetical strings Men 11 3,902 Aug-06-2022, 07:48 AM
Last Post: mariasmith1122
  how to write code demon_calcifer 1 1,595 Nov-16-2021, 04:09 PM
Last Post: Larz60+
  Can someone please help me write the code Ram 8 3,245 Feb-08-2021, 08:21 AM
Last Post: Serafim
  Please help me to write code for this vij 8 3,704 Jun-10-2020, 12:13 PM
Last Post: pyzyx3qwerty
  Write pseudo code for a class assignment Scrimshot 3 3,328 May-07-2019, 05:38 PM
Last Post: Scrimshot
  In need help to put this code in order lekuru01 4 3,059 Apr-11-2019, 05:50 AM
Last Post: loomski
  Wrong output on my code. JTNA 2 7,852 Apr-04-2019, 01:55 PM
Last Post: JTNA
  Help!! Order form and receipt code beginner1996 2 3,243 Mar-07-2019, 03:22 PM
Last Post: beginner1996

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020