Company: TCS codevita
Difficulty: medium
HammingDistance Vyom just learned about binary numbers. One day his tutor gave him T similar tasks and asked him to find the answer for them. As the number of tasks is more and also the size of input in each task is large, he concluded that manual calculation will be tough, so he decided to write a program for that. Given T binary strings of varying lengths which consists of only 0s and 1s. He will be given two values A and B which indicates cost of one occurrence of sub strings "01" and "10". The total cost of the given string will be the sum of the costs of all "01" and "10". His task is to minimize the cost of given strings in each case, by rearranging it in any order. After rearrange the string, he has to find the hamming distance between the original string and the rearranged string and print it in each case. In case of invalid input, print "INVALID". If there are more than one rearrangement which gives least cost, then consider the string which gives minimum hamming distance. Not