Concatenate strings in any order to get Maximum Number of "AB"
Given an array of strings of length N, it is allowed to concatenate them in any order. Find the maximum possible number of occurrences of 'AB' in the resulting string. Examples: Input : N = 4, arr={ "BCA", "BGGGA", "JKA", "BALB" } Output : 3 Concatenate them in the order JKA + BGGA + BCA + BALB and