When I was younger, I had a big map of the US tacked up on my wall across from my bed. When I was bored, I would stare at that map and think about stuff. Stuff like the four-color-theorem, or which state bordered the most other states. To save younger me some brainpower in counting, you are going to
invent a time machine and tell me how many states border the input. Because time is finicky, this needs to be as short as possible.
Given one of the 50 US states, either by its full name or by its postal abbreviation, as found on this page (archive.org mirror), return the number of states it borders. The following is a mapping of all inputs for full state names to the number of states adjacent, found on this website.
Missouri, Tennessee -> 8 Colorado, Kentucky -> 7 Arkansas, Idaho, Illinois, Iowa, Nebraska, New York, Oklahoma, Pennsylvania, South Dakota, Utah, Wyoming -> 6 Arizona, Georgia, Massachusetts, Michigan, Minnesota, Nevada, New Mexico, Ohio, Virginia, West Virginia -> 5 Alabama, Indiana, Kansas, Maryland, Mississippi, Montana, North Carolina, Oregon, Texas, Wisconsin -> 4 California, Connecticut, Delaware, Louisiana, New Hampshire, New Jersey, North Dakota, Rhode Island, Vermont -> 3 Florida, South Carolina, Washington -> 2 Maine -> 1 Alaska, Hawaii -> 0
- Your program can either handle the full state name or the postal code - it cannot use a combination.
- You can specify the case of the input, but you cannot remove whitespace in the input.
- You do not have to handle Washington, D.C., or anything that is not one of the 50 states.
- The number of states bordered does not include the input state.
- This is code-golf, so shortest answer in bytes wins.
While I know this may just be whoever has the best compression or finds the best regex pattern per number, if I get too many of those answers, I'll award a bounty to an answer that generates a map of the US and uses that to calculate the number of bordering states.