This question is based on prime factorization method.
As given there are 12 peaches and 18 nectarines
Factors of 12 are : 2,3,4,6 and 12
Factors of 18 are : 2,3,6,9 and 18
As mentioned, fruits are divided into the same number of equal groups, so the groups can be formed as-
1. 6 groups of peaches with 2 in each and 6 groups of nectarines with 3 in each,
2. 3 groups of peaches with 4 in each and 3 groups of nectarines with 6 in each.
3. 2 groups of peaches with 6 in each and 2 groups of nectarines with 9 in each.