SP19490 PAUWS - Pair and unpair weightest string

Description

Once I went market to buy a teddy. The shopkepper offered a puzzle and said he'll give me whatever i wish at a huge discount if i give him the working piece of code for following problem. You will be given a string S of length N, containing either 'A' or 'B'. Make all the possible lists from the given list, with the given operation that you are allowed to change one symbol into another. Then assign maximum weight to each of the string and get the string with maximum weight && return the weight. You have only following two ways to assign weight to symbol : 1\. Pair a S\[i\] symbol with adjacent one (S\[i\] or S\[i-1\]). Each symbol can only be paired with exactly one symbol. Weight of a pair is 4. Pair will be either 'AB' or 'BA'. 2\. Keep a S\[i\] Symbol indepedent. Weight of unpaired symbol is 1. 3\. Each symbol is either involved in exactly one either pair or unpaired status. 4\. For each string, Keep in mind the number of symbols(K) with index i, 1

Input Format

N/A

Output Format

N/A