Wanna be an Alchemist
I've been watching Full Metal Alchemist these past days and I've been wondering, It is really possible to trans-mutate matter? In the real world, I don't know if it is possible, but in the machine world, we think we "can".
Problem
Your task is, Given an input of N chemical elements (K, Mg, C, O, etc...), you are going to:
- Get the first letter of the element
- Convert that letter into binary
- Rotate 2 bits to the right
- Apply Binary Addition
- If the result is more that 8 bits then get the one's complement of the result and removes the highest bit
- Output the ASCII (ISO 8859-1) representation of the result
Example
Given Chemical Elements: (K, Ca, Mg)
- Get the first letter of the element
K, C, M
- Convert that letter into binary
K => 01001011, C => 01000011, M => 01001101
- Rotate 2 bits to the right
K => 11010010, C => 11010000, M => 01010011
Sum bits
K => 11010010
+C => 11010000
+M => 01010011
=111110101
If the result is more that 8 bits then get the one's complement and removes the highest bit
00001010
- Output the ASCII representation of the result.
Result:
Test Cases
(H, Mn, C) => Ê
(I, H, Se) => Ç
(K, Ca, Mg) =>
This is code golf so the shortest answer wins