Write a program that reads a string and display the longest substring of the given string.
Answers
Answered by
3
string = input("Enter a string:")
length = len(string)
maxlength = 0
maxsub ='' #empty string
sub ='' #empty string
lensub = 0
for a in range(length):
if string[a] in 'aeiou' or string[a] in 'AEIOU' :
maxsub = sub
maxlength = lensub
sub = ''
lensub = 0
else :
sub += string[a]
lensub = len(sub)
a += 1
print ("Maximum length consonant substring is :" , maxsub, end = ' ')
print ("with", maxlength, "characters")
pls mark as brainlist...
Similar questions