Genetics and Computers
Difficulty : Easy
Community success rate: 80%
Approved by jordan_codingame GuillaumeLAURIE DeathMask
A higher resolution is required to access the IDE
- 68
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
You will be given the genotypes of 2 parent plants as parent_1 and parent_2 respectively. We are using a Dihybrid Cross, where 2 characteristics of each parent plant will be taken. Your code must determine the genes of their possible progeny by using Checkerboard method. By checkerboard method or Punnett Square method, you can cross the genes of the parents and find the possible characteristics of its seedlings.Let us for example take RrYy and RrYy to be the parent plants. By Checkerboard method:
In RrYy, multiply R with Y and y, and r with Y and y. You will get RY, Ry, rY and ry as the genes. Represent them in the top column. Do the same for the second parent and represent them in the first row. Now multiply the rows and columns. For example, in the first row, RY is both the column as well as the row. Multiplying them, you get RYRY. Now, arrange it by the rule specified below.
_______
These are the 16 possible genotypes of the seeds. The same genotype can appear more than once if it can be made by different parental genes. For example, RrYy appears four times in this table. (Note: Dominant genes are written in capital and recessive ones are written in lowercase. A dominant gene is always placed before a recessive gene. For example: r,R,y,Y must be written as RrYy.)
Cross the parent genes using this method and count the number of progeny with the genotypes requested in the input. Add a colon (
Input
Line 1: The genes of parent_1 and parent_2
Line 2: The format of genotypic ratio
Line 2: The format of genotypic ratio
Output
Line 1: The genotypic ratio as per the format provided in second line of input
Constraints
Length of parent_a = Length of parent_b = 4
Length of ratio < 50
Length of ratio < 50
Example
Input
RRYY RRYY RRYY:rryy
Output
1:0
A higher resolution is required to access the IDE