Kindle Direct Publishing, Amazon’s e-book self-publishing platform,…

Question Answered step-by-step Kindle Direct Publishing, Amazon’s e-book self-publishing platform,… Kindle Direct Publishing, Amazon’s e-bookself-publishing platform, is working on a nevfeature to help authors use special textcharacters in different ways. They have askedfor your help in beta testing a new part of thefeature involving round and square brackets.Given a string that consists of characters (, ), [, ] and ?, determine now many ways Itcan be split into two non-empty substringssuch that the characters in each substring canbe rearranged into a balanced string. Asequence of round and square brackets canbe rearranged into a balanced sequence ifand onlv if the number of opened and closedbracket is equal for both types of thebrackets. The question marks can take theplace of any needed character, and thesudstrings togetner must contain the entirestring,Note: A substring is a contiguous group ofcharacters in a stringExample: s = ‘[(?)][??[‘ Image transcription textThe string s can be split into two balanced substrings as follows: 1. $1 = [(?] and $2 = [??[. o Replace the ? ins7 with ) to have a balanced string [0]. Replace the question marks in s2 with ] and rearrange to make [] or 0. 2.$1 = [(?][? and s2 = ?]: Replace the ?s in $7 to get [0]. o Replace the ? in s2 with [ to get . Constra… Show more… Show more Computer Science Engineering & Technology C++ Programming Share QuestionEmailCopy link Comments (0)