Company: Company: Flipkart / Platform: Hirepro
Difficulty: medium
A farewell dance party is being organised for the graduating students of a college where students are supposed to dance in pairs. A boy and a girl together form one pair. All the n students are standing in a row, and are asked to pair up with any partner they can find within a distance d from their position. The students are trying to find as many pairs as possible. Can you write a program to determine the maximum number of pairs possible? Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the output and test cases will fail. Constraints: 3 <= n <= 100 arr[i] = ['B', 'G'] 1 <= d <= 10 Input Format: The first line of input consists of an integer n, that determines the number of students. The second line of input contains n-space separated characters (either B or G), where B represents a boy and G represents a girl. The third line of input contains an integer d, which is the range in which a