|
|||
Find the Identical Twins and TripletsThe real story (three identical strangers)Starting with 1960, the psychiatrist Peter Neubauer conducted a controversial study about identical twins and triplets adopted apart. The purpose of this study was to determine which factor is more important in development of a human being: genetics or environmental. Twenty years after, Robert Shafran, David Kellman, and Eddy Galland found one another through sheer coincidence and discovered they were separated after their birth. After that, Peter Neubauer ceased the study, all the collected data have been sealed at Yale University and can't be opened until 2066. The problem to be solvedGiven a database of population, your task is to identify every group of identical twins or triplets (sharing the same DNA) and display the members of every group where at least one member is adopted. Input SpecificationThe database of population includes some pieces of information about each person, from which we selected only the necessary ones. The database is described as follows:
After inserting a group of twins or triplets, not used positions between consecutive personal codes (considering the ascending order) will never be assigned. For example, in the case of the sample input (see below), 128, 130, and 131 will never be assigned. Output SpecificationAfter identifying all groups of identical twins or triplets, display the members (with personal code and name separated by a space) of each group where at least one member is adopted. Insert an empty line between any two consecutive groups. The list should be ordered by personal code. Sample Input
Output for Sample Input
ExplanationThe following groups are identified:
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |