Question

Please answer in Python 3! 16.2** (Maximum increasingly ordered subsequence) Write a program that prompts the...

Please answer in Python 3! 16.2** (Maximum increasingly ordered subsequence) Write a program that prompts the user to enter a string and displays the maximum increasingly ordered subsequence of characters. Analyze the time complexity of your program. Here is a sample run: Enter a string: Welcome Maximum consecutive substring is ['W', 'e', 'l', 'o']

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If You Have Any Doubt Please Comment Below

Code:-

def Maximumconsecutivesubstring(str):
  
l = len(str)
count = 0
  
# Find the maximum repeating
# character starting from str[i]
res = str[0]
for i in range(l):
  
cur_count = 1
for j in range(i + 1, l):
  
if (str[i] != str[j]):
break
cur_count += 1
  
# Update result if required
if cur_count > count :
count = cur_count
res = str[i]
return res
  
# Driver code
if __name__ == "__main__":
  
str = "Hi this is HomeworkLib qqquestiom"
print("Maximum consecutive substring is ")
print(Maximumconsecutivesubstring(str))

Output:-

Add a comment
Know the answer?
Add Answer to:
Please answer in Python 3! 16.2** (Maximum increasingly ordered subsequence) Write a program that prompts the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT