A higher resolution is required to access the IDE
- 4
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
This problem aims to determine the chemical name of an organic compound, given a chemical formula.An organic compound is made of at least one carbon (
Prefix
Depending on the amount of carbon, a different prefix is used.
Prefix | No. of Carbon Atoms (n)
-------+-------------------------
meth- | 1
eth- | 2
prop- | 3
but- | 4
pent- | 5
hex- | 6
hept- | 7
oct- | 8
non- | 9
dec- | 10
Suffix
- Alkane contains 2n+2 hydrogen atoms and ends with
- Alkene contains 2n hydrogen atoms and ends with
- Alcohol contains a
- Carboxylic acid contains a
- Aldehyde (also known as alkanal) contains 2n hydrogen atoms AND contains an aldehyde functional group (appear as
- Ketone (also known as alkanone) contains 2n hydrogen atoms. The carbonyl functional group
Please note that the total number of oxygen atoms would NOT exceed those present in the functional group in this problem.
Chemical Formulae
In this puzzle, chemical formulae refer to molecular formulae and condensed formulae only. Molecular formulae show the actual number of atoms in a compound, and condensed formulae are a shorthand way to show how atoms are connected in a molecule. In the context of this puzzle, chemical formulae should ONLY contain
If the chemical formula does not fit the criteria for any compound type mentioned above, output
-------------------------------------------------------------------------------------------------------------------------
Example
1. C2H6
- It has
- It is an alkane as it has
- Knowing the above information, this molecule is ethane.
2. CH3CH2COOH
- It has
- It has
- This is propanoic acid.
3. HCOOCH3
- It has
- HOWEVER, it has TWO oxygen atoms which do not fit the criteria for all of them.
- You then output OTHERS (this is methyl methanoate).
- Why this is not ethanoic acid (CH3COOH)? The functional group
Header image credit: https://www.chemicals.co.uk/blog/a-level-chemistry-introduction-to-organic-chemistry
Input
Line 1: Chemical formula consists of capital letters and may contain positive integers (possibly consisting of more than one digit) to indicate the number of atoms.
Output
Line 1: Chemical name of the organic compound in lowercase or OTHERS .
Constraints
n, the number of carbon atoms in the compound, is an integer.
n ≤ 10
If the organic compound is an alkene, n > 1.
If the organic compound is a ketone, n ≥ 3.
n ≤ 10
If the organic compound is an alkene, n > 1.
If the organic compound is a ketone, n ≥ 3.
Example
Input
C2H6
Output
ethane
A higher resolution is required to access the IDE