Based on Practical Golf - US StatesPractical Golf - US States
Your task is to find the abbreviation (symbol) of an element given the element name, up to and including ununoctium (118). Use the periodic table on Wikipedia.
Thanks to squeamish ossifrage, you can find a full list of elements to abbreviations at http://pastebin.com/DNZMWmuf.
You may not use any external resources. In addition, you may not use any built-in data specifically about the elements of the periodic table. Standard loopholes apply.
Input
Input may be from stdin, file, prompt
, input
etc.
Input Format:
All of the following are valid inputs:
Carbon
carbon
CARBON
cArBOn
Essentially, the element name - case insensitive.
You do not have to handle misspellings or any invalid element name. Invalid input is undefined behavior.
Output:
The symbol for the element. The first character must be capitalized and the rest must be lowercase.
Example output: C
Test cases:
Carbon -> C
NiTROGen -> N
Sodium -> Na
Gold -> Au
Silver -> Ag
Tin -> Sn
There are many more elements than states, so I expect it to be harder to find a general rule for these.
This is code golf. Shortest code wins!