Question: An alternating string is a string in which no two consecutive characters are same. Ramesh loves alternating strings. So, on his birthday, he recieves x
An alternating string is a string in which no two consecutive characters are same. Ramesh loves alternating strings. So, on his birthday, he recieves x amount of letter 'a', y amount of letter 'b', and z amount of string "ab" as gift. Now, he wants to assemble the largest alternating string using this birthday gift. Write a program to print the length of the longest such string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
