2
Background
You are bored in class, and having exhausted all the possible things to write on a standard calculator (Like 8008135) you turn to the periodic table. You want to figure out if you can write your message using the shorthand for chemical elements.
This is the inverse of this challenge.
The Challenge
Input: A sentence, or a word.
Output: The placement of each chemical element used in the sentence. If the sentence / word can not be created, you must return blank, False or throw an error.
Test cases Input 1:
fire
Output 1:
9 53 75
Input 2:
Crazy Input
Output 3:
False
Input 3:
american ass
Output 3:
95 68 53 20 11 16 16
Note: There is no problem with a element being in two words as shown in the last example. American can be written as 95 68 53 20 7
but then Ass
is impossible to write due to the lack of an A in the table. In other words discard all whitespaces (but they must be allowed) in input.
Note Standard loopholes are not allowed including built in periodic tables and libraries.
Scoring
Submissions will be scored in bytes. I recommend this website to keep track of your byte count, though you can use any counter you like.
This is code-golf, so the lowest score wins!
1Is the use of periodic table built-ins allowed? – Dennis – 2015-11-26T13:59:00.370
I forgot Mathematica had such capabilities! On one hand this gives and advantage to a very few select languages, on the other hand hardcoding these will be a pain. Being the more experienced what do you think @Dennis? – N3buchadnezzar – 2015-11-26T14:02:36.973
1Encoding the table is the biggest part of the challenge, so a built-in table would, in my opinion, trivialize it for some languages. Personally, I'd disallow them. – Dennis – 2015-11-26T14:05:42.073
1Related. – Martin Ender – 2015-11-26T14:21:44.603
Yes. Updated it now. – N3buchadnezzar – 2015-11-26T14:35:29.740