In the world of birding there are four-letter codes for the common names of birds. These codes are created by some simple rules:
There are other ways codes are created, but this challenge will only use the four rules listed above.
In this challenge you will write a function that takes an array of strings of common bird names and create the codes for those names based on the rules above. The function will return an array of codes in the same order in which the input names were presented.
birdCode(["Black-Capped Chickadee", "Common Tern"]) ➞ ["BCCH", "COTE"]
birdCode(["American Redstart", "Northern Cardinal"]) ➞ ["AMRE","NOCA"]
birdCode(["Bobolink", "American White Pelican"]) ➞ ["BOBO","AWPE"]