Computer Science, asked by pritamkuanr, 8 months ago

4. Write a program that can accept two strings as input and print the string with
maximum length in console. If two strings have the same length, then the
program should print both the strings line by line​

Answers

Answered by premsheela0306
2

Answer:

Input : str = "abba"

Output : 2

The maximum number of characters are

between two occurrences of 'a'.

Input : str = "baaabcddc"

Output : 3

The maximum number of characters are

between two occurrences of 'b'.

Input : str = "abc"

Output : -1

Answered by Anonymous
3

HOPE IT HELPS :

Solution :

str1 = input (' Input one string : ')

str2 = input (' Input another string : ')

# The above command will accept the values from the user .

a = len( str1 )

b = len ( str2 )

# variables will contain the length of strings

if a>b :

   print ( str1 )

elif b>a:

   print( str2 )

else :

   print( str1 )

   print( str2 )

STAY HOME STAY SAFE

x JOKER ALWAYS x

Similar questions