JCC25 Contest 1 P2 - Ionic or Molecular?


Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Assembly, Awk, Brain****, C, C++, Java, Lua, Pascal, Perl, PyPy 2, PyPy 3, Python, Sed

Jason is trying to find out whether a molecule is ionic or molecular.

An ionic compound's name is comprised of the metal followed by the non-metal with the ending replaced with ide

For example an ionic compound comprised of Potassium and Oxygen would be named potassium oxide

A molecular compound's name is comprised of the amount of the first non-metal followed by its name, then the amount of the second non-metal followed by its name with the ending replaced with ide

For example a molecular compound comprised of 2 Hydrogens and 1 Oxygen would be named dihydrogen monoxide

If there is only one of the first element, there is no prefix. For example 1 Carbon and 1 Oxygen form carbon monoxide

The list of prefixes used are

mono
di
tri

Given \(N\) molecules, determine whether they are Ionic or Molecular

Constraints

\(1 \le N \le 10 ^ 2\)

Input Specification

The first line will contain an integer \(N\)

The next \(N\) lines will contain one string per line, the molecule \(a_i\)

No compounds will contain elements like sodium, with a prefix in its name

Output Specification

Output line seperated strings Ionic or Molecular based on what \(a_i\) is

Sample Input

3
dihydrogen monoxide
calcium chloride
dihydrogen

Sample Output

Molecular
Ionic
Molecular

Explanation for Sample Output

dihydrogen monoxide contains the prefixes mono and di, meaning it has to be molcular

calcium chloride does not contain any prefixes, meaning it has to be ionic

dihydrogen contains the prefix di, meaning it has to be molecular


Comments

There are no comments at the moment.