Company: Flipkart
Difficulty: medium
Queue Balancing Challenge Given a string representing a queue of players from a team, which can contain the characters \'A\', \'B\', and \'C\', where \'B\' occurs only once as the common player, both teams are rivalrous, and players of these teams do not want to stand adjacent. Therefore, \'B\' acts as a middle person who partitions the queue. Your task is to determine the minimum number of moves required to form a new queue that is balanced, such that all \'A\' characters are on one side and all \'C\' characters are on the other side with \'B\' in the middle. A move is defined as either: A player entering to the end of the new queue from the front of old queue, or A player chooses to go back to the end of the old queue and wait for the next turn. Note: If they are already balanced, they still need to form a new queue. So, moves cannot be zero. Unbalanced input string will have at least one occurrence of \'A\', \'B\', and \'C\'. \'B\' only occurs once. Input Format The first line of in