Retired
Chemical Name (retired)
36Admiraal
Description:
Goal
The goal of this Kata is to implement to_chemical
which will make some letters in a name uppercase such that it represents valid chemical symbols. We only consider chemical symbols which are either 1 or 2 characters long.
The input name
will be a lowercase String and the output should also be a String.
A Set of valid chemical symbols called CHEM_SYMBOLS
is preloaded.
Note: Sometimes there may be several correct answers, just return one of them.
Examples
to_chemical("") => ""
to_chemical("admiraal") => ""
"A or Ad are not valid symbols"
to_chemical("codewars") => "C" + "O" + ... => ""
"`C` and `O` are valid but 'D' or `Od` or `De` are not valid symbols"
to_chemical("nam") => "Na" + .. => "N" + "Am" => "NAm"
to_chemical("namo") => "N" + "Am" + "O" => "NAmO" or "Na" + "Mo" => "NaMo"
to_chemical("dsb") => "Ds" + "B" => "DsB"
to_chemical("hiphop") => "H" + "I" + "P" + "H" + "O" + "P" => "HIPHOP" or "H" + "I" + "P" + "Ho" + "P" => "HIPHoP"
to_chemical("baga") => "B" + "Ag" + .. => "Ba" + "Ga" => "BaGa"
Algorithms
Similar Kata:
Stats:
Created | May 7, 2020 |
Warriors Trained | 294 |
Total Skips | 120 |
Total Code Submissions | 175 |
Total Times Completed | 36 |
Python Completions | 36 |
Total Stars | 8 |
% of votes with a positive feedback rating | 68% of 20 |
Total "Very Satisfied" Votes | 12 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 21 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 8 kyu |