Given a string contains only "B"s and "G"s indicated a sequence of students, while "B" means a boy and "G" means a girl. The students are playing a game. Initially everyone is standing in a circular path in the school lawn. The student at index 0 is standing next to student at index n-1 and before the student at index 1. All the girls need to stand together to win the game. The girls had influencial power to influence the boys to swap the positions. Help the girls decide the minimum number of swaps they have to do so that all of them stand together.
Example 1:
Input: "BBGBGBG"
Output: 1
Explanation: We only need to swap a girl at position 2 with a boy at position 5: BB(G)BG(B)G -> BBBBGGG