39. Get the Groups As new students begin to arrive at college, each receives a unique ID number, 1 to n. Initially, the students do not know one another, and each has a different circle of friends. As the semester progresses, other groups of friends begin to form randomly. There will be three arrays, each aligned by an index. The first array will contain a queryType which will be either Friend or Total. The next two arrays, students1 and students, will each contain a student ID. If the query type is Friend, the two students become friends. If the query type is Total, report the sum of the sizes of each group of friends for the two students. Example n = 4 query Type = ['Friend', 'Friend', 'Total'] student 1 = [1, 2, 1] student2 = [2, 3, 4] Initial Friend 1 2 & Friend 2 3 Total 14 Size:1 Size:1 Size:1 Size:1 Size:3 Size:1 3 + 1 = 4 2 The queries are assembled, aligned by index: Index student2 studenti 1 0 2 query Type Friend Friend Total 1 2 3 2 1 4 Students will start as discrete groups {1}, {2},{3} and {4}. Students 1 and 2 become friends with the first query, as well as students 2 and 3 in the second. The new groups are {1, 2}, {2, 3} and {4} which simplifies to {1, 2, 3} and {4}. In the third query, the number of friends for student 1 = 3 and student 4 = 1 for a Total = 4. Notice that student 3 is indirectly part of the circle of friends of student 1 because of student 2. Function Description Complete the function getTheGroups in the editor below. For a query of type Total with an index of j, the function must return an array of integers where the value at each index j denotes the answer. getTheGroups has the following parameter(s): int n: the number of students string query Type[g]: an array of query type strings int student1[q]: an array of student integer ID's int student2[q]: an array of student integer ID's Constraints • 1sns 105 • 15qs 105 • 1 s students 1[i], students2[i] n query Types[i] are in the set {'Friend', 'Total'} . Input Format for Custom Testing Input from stdin will be processed and passed to the function as follows: The first line contains an integer n, the number of students. The next line contains an integer q, the number of queries. Each of the next qlines contains a string queryType[i] where 1 sisq. The next line contains an integer q, the number of queries. Each of the next qlines contains a string students1[i] where 1 sisq. The next line contains an integer q, the number of queries. Each of the next qlines contains a string students2[i] where 1 sisq. Sample Case o Sample Input 0 STDIN Function 3 → n = 3 2 → queryType [] size q = 2 Friend – query = ['Friend', 'Total'] Total 2. → students1[] size q = 2 1 → studentsl = [1, 2] 2 2 → students2[] size q = 2 2 → students2 = [2, 3] 3 Sample Output 0 3 Fynlanation 0