[Question]
  [
Given one of the 50 U.S. [state names](https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#States) on the left as input, output its two-letter [postal code](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations#Postal_codes) as shown to the right:
```
Alabama         AL
Alaska          AK
Arizona         AZ
Arkansas        AR
California      CA
Colorado        CO
Connecticut     CT
Delaware        DE
Florida         FL
Georgia         GA
Hawaii          HI
Idaho           ID
Illinois        IL
Indiana         IN
Iowa            IA
Kansas          KS
Kentucky        KY
Louisiana       LA
Maine           ME
Maryland        MD
Massachusetts   MA
Michigan        MI
Minnesota       MN
Mississippi     MS
Missouri        MO
Montana         MT
Nebraska        NE
Nevada          NV
New Hampshire   NH
New Jersey      NJ
New Mexico      NM
New York        NY
North Carolina  NC
North Dakota    ND
Ohio            OH
Oklahoma        OK
Oregon          OR
Pennsylvania    PA
Rhode Island    RI
South Carolina  SC
South Dakota    SD
Tennessee       TN
Texas           TX
Utah            UT
Vermont         VT
Virginia        VA
Washington      WA
West Virginia   WV
Wisconsin       WI
Wyoming         WY
```
## Rules
* **Input and output are both case sensitive.** You many not output e.g. `Al` for `Alabama`.
* You may assume the input is one of the 50 state names shown above.
* You may not access the internet or use built-in state data (looking at you, Mathematica).
Separate lists of inputs and outputs can be found in this snippet (please don't run it, it's just for compressing the post):
```
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming
AL
AK
AZ
AR
CA
CO
CT
DE
FL
GA
HI
ID
IL
IN
IA
KS
KY
LA
ME
MD
MA
MI
MN
MS
MO
MT
NE
NV
NH
NJ
NM
NY
NC
ND
OH
OK
OR
PA
RI
SC
SD
TN
TX
UT
VT
VA
WA
WV
WI
WY
```
(Non-scoring) Brownie points if you can also take `District of Columbia` as input and produce `DC`, Virgin Islands, etc etc.
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the **shortest code in bytes in each language wins**.
(Originally [proposed](https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges/12398#12398) by ETHProductions)
  
[Answer]
## Javascript (2023), 88 bytes
This is originally based on HP Williams solution, with some improvements outside the regex, and a couple of tweaks within it, plus a couple of bytes from Primo and Emanresu.
```
s=>s[0]+s.match`.+ .|.+z|...s.s?|T..|M[i-t]+|[AFINOUW][^o]v?|.+`[0].at(-1).toUpperCase()
```
It matches a chunk at the start of the name, then returns the capitalised last letter of that chunk appended to the first letter of the name.
Commentary for the regex:
```
.+ .           // Two word states (NJ, NM, NH, NY, WV, ND, SD, RI,NC,SC)
.+z            // AriZona
...s.s?        // MissiSsippi, MissOuri, MassAchussetts, AlasKa, and KansaS
M[i-t]+        // MonTana, MinNesota, MIchigan
[AFINOUW][^o]v?  // All the other first-two-letter states, avoiding Iowa/Connecticut/Louisiana, plus NeVada
T‌​..            // TeNnessee, TeXas
.+             // Everything else
```
Alternative regex's (same length):
```
...(a$|z|s.s?|.* .)|M[i-t]+|T..|[AFINOUW].v?|.*  
.*( .|z)|...s.s?|Te.|M[i-t]+|[^GHKMPVo]{2}v?|.*
.*( .|z)|...s.s?|M[i-t]+|[^GHKMPVo]{2}[vnx]?|.*
.+ .|...s.s?|[MNTe]+[i-z]+|.+z|[AFINOUWow]+.|.+
.+( .|z)|...s.s?|[MNT]e?[i-x]+|[AFINOUWow]+.|.+
```
## History
With linebreaks for readability:
### 90
```
s=>s[0]+
  /.$/.exec(s.toUpperCase()
    .match`.* .|.*Z|...S.S?|T..|M[I-T]+|[AFINOUW][^O]V?|.*`
  )
```
### 92
```
s=>s[0]+
/.*( .|z)|...s.s?|T..|M[i-t]+|[AFINOUW][^o]v?|.*/
.exec(s)[0].slice(-1).toUpperCase()
```
### 94
```
s=>s[0]+/.*( .|z)|...s.s?|M[io]n?t?|[AFIOUWN][^o]v?|T..|.*/
.exec(s)[0].slice(-1).toUpperCase()
```
### 99
```
s=>s[0]+/.*( .|z|l.*k)|T..|M.ss.s?|M[io]n?t?|[AFIOUWN][^o]v?|.*/
.exec(s)[0].slice(-1).toUpperCase()
```
### 101
```
s=>s[0]+/.+[A-Zz]|Nev?|.*sk|M.ss.s?|M[io]n?t?|[AFIOUW][^o]|T‌​e.|.+/
.exec(s)[0].sl‌​ice(-1).toUpperCase(‌​)
```
### 108
```
 s=>s[0]+/MI(N|SSO|S)|[CDGHKLPV].*|.* .|.*[XZV]|.*?N[NTE]|.*(SK|D$|WA)|../
.exec(s.toUpperCase())[0].slice(-1)
```
### 110
```
s=>s[0]+/MI(N|SSO|S)|[CGHKLPV].*|.* .|.*[XZV]|.*?N[NTE]|.*(SK|[ED]$|WA)|../
.exec(s.toUpperCase())[0].slice(-1)
```
### 113
```
s=>s[0]+/^MI(N|SSO|S)|^[CGHKLPV].*|.*?( .|[XZV])|.*?N[NTE]|.*(SK|[ED]$|WA)|../
.exec(s.toUpperCase())[0].slice(-1)
```
### 132
```
s=>(S=s.toUpperCase(),' ._SSO_^MI[NS]_^[CGHKLPV].*_.V_N[TNE]_SK_[ED]$_WA_Z_X_..'
.split`_`.some(p=>s=S.match(p)),S[0]+s[0].slice(-1))
```
### 134
```
s=>' ._SSO_^MI[NS]_^[CGHKLPV].*_.V_N[TNE]_SK_E$_D$_WA_Z_X_..'.split`_`
.map(p=>s=(z=s.toUpperCase().match(p))?s[0]+z[0].slice(-1):s)&&s
```
### 135
```
s=>' ._SSO_^MI[NS]_LASK_^[CGHKLPV].*_NT_EN_[DE]$_WA_.[XVZ]_..'.split`_`
.map(p=>s=(z=s.toUpperCase().match(p))?s[0]+z[0].slice(-1):s)&&s
```
### 137
```
s=>' ._OWA_SSO_ONT_^MI[NS]_LASK_^[CGHKLPV].*_EN_[DE]$_.[XVZ]_..'.split`_`.
map(p=>s=(z=s.toUpperCase().match(p))?s[0]+z[0].slice(-1):s)&&s
```
[Answer]
## Javascript, ~~124~~ 117 bytes
(saved 7 bytes thanks to hvd)
```
x=>/.+[A-Z]|A..[sz]k?|M.ss.s?|M[io]n?t?|Nev?|[AFIOUW][^o]|T..|.+/.exec(x)[0].replace(/(.).*(.)/,'$1$2').toUpperCase()
```
Explanation:
* The regexp finds a match with the first and last letters the two letters of the abbreviation
* First part matches states with more than two words (including District of Columbia)
* Second part matches Alaska and Arizona
* Third part matches Massachusets, Mississippi and Missouri
* Fourth part matches Michigan, Minnesota and Montana
* Fifth part matches Nebraska and Nevada
* Sixth part matches all remaining states abbreviated to their first two letters, with a special case to exclude Iowa
* Seventh part matches all remaining states abbreviated to their first and third letters
* Eighth part matches everything else, which are abbreviated to their first and last letters
* Then it is just a case of stripping of those letters and capitalising
* Also matches Puerto Rico and American Samoa, but not Guam, Marianas islands or US Virgin Islands
[Answer]
## JavaScript (ES6), ~~156~~ 136 bytes
```
s=>s[0]+'.KT..N.VEA.XVL.H.TZ.AA..I.EADATO.JTISRDIYOI.DALA.Y.KE.C.D.R.YAS.NM...C.L...N'[parseInt(s.split` `.join``,36)%359%248*8%99*3%83]
```
### Demo
```
let f =
s=>s[0]+'.KT..N.VEA.XVL.H.TZ.AA..I.EADATO.JTISRDIYOI.DALA.Y.KE.C.D.R.YAS.NM...C.L...N'[parseInt(s.split` `.join``,36)%359%248*8%99*3%83]
;[
  "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
  "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi",
  "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio",
  "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia",
  "Washington", "West Virginia", "Wisconsin", "Wyoming"
]
.map(s => console.log(s, '-->', f(s)))
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 75 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
³Oḅ⁹%⁽qġ%14ị⁽"wB¤Ḥ
“¿ØƈṢḍw÷S=)µZṂ÷ĿæÆɱ»Ḳiµ%2+3¢⁸?
e“\B“½ƈN»ȧ5ȯÇ’
i⁶ȯÇ‘ịṭḢŒu
```
**[Try it online!](https://tio.run/nexus/jelly#@39os//DHa2PGneqPmrcW3hkoaqhycPd3UC2UrnToSUPdyzhetQw59D@wzOOdTzcuejhjt7yw9uDbTUPbY16uLPp8PYj@w8vO9x2cuOh3Q93bMo8tFXVSNv40KJHjTvsuVKBGmOcQLr3HuvwO7T7xHLTE@sPtz9qmMmV@ahxG4Q9A2jZw51rH@5YdHRS6f///5UccxKLsxOVAA "Jelly – TIO Nexus")**
...or see a **[test suite](https://tio.run/nexus/jelly#VZFbaxNBFMff8ymWQB5EffD2JN6aoo1tGrFq8YZMd8fsYTczcWa3aXxKitpC8cWnivpgKIqgFcXYXUMp7NYSP8bsF4lnZteAMDC/M@f8z20myW5DRc@zflzJ@vtPDt9XTp1Voy3kcmcm2VHRTinrvU0O0u2jTRUPVPSyk@4tXTiWDO@peD3dOzxIP6Qv/nxLRir6Dsmwcvr4mWSQ9aNLJYrCBzNavX@0uZiMxh/Pjb@mG1nvdQmy/s@ct7GYir@oaPD7VThB3Xg3@ZQMFx5dzvo/MEr92jqPKU5etKys9w796YaKn5VQuv5ZxW/QNZncL1/xyQppkfIJTdIzIOApZzl5hEkiEavEh8dcMNDvVe5zQRxukDFqB2CHAVqz1CcdIijiVQwBR0dfo1w0jW4OnQAINYe4Wl3zfWAcdIEac4CYqjXe0df8v9LzlAWh7XURF3gIsgirE2DU3KLrE@YYlJLYbihpEGhlHWwXmoQZxD4lD4wSpNSn3YbC4qEwyFmQJ1@kK6JYxyJdJU4OHWuOtNrSBTOhtq9TIWm3MOp0DWxeGHe58DRyEbhWlQiOk5Lpwyzx8l4aLmhFw/NxI@YfGoI2uW75BmVMdv1Vki/9pssdatVkMesSD/9PnD9ME9@iemBJqeE1s8nbAXHxukNFCyfVBPgzefplgnOxZmBKL4O0OZNguMtb6NBEZWBNJQ//Ag)** - Note a small change had to be made to run the full program for multiple inputs in one go (I swapped out the program input atom, `³`, for a recall from register, `®`, one and set the register to each state name in turn).
### How?
Calculates the index to use for the second character of the postal code, appends it to the first character and uppercases the result.
First finds the index of a space character (or 0 if not found);
Else checks if it is Alaska or Missouri (yielding 5 for `k` or `o`);
Else finds the index of the input state in the list `Arizona Minnesota Mississippi Nevada Montana Texas Tennessee` (or 0 if not found) - if so it takes that index mod 2 plus 3 (for `z n s v t x n`);
Else converts the string to ordinals, converts that from base 256, finds the remainder of that after dividing by 29487, finds the remainder of that after dividing by 14 and uses that to index into the binary representation of 9620 and doubles the result - yielding 0 for states that use their final letter and 2 for those that use their second letter.
All but the very first case are incremented, and the resulting value is decremented (upping the space index found by one).
```
i⁶ȯÇ‘ịṭḢŒu - Main link: state string
 ⁶         - space character
i          - first index (of a space character in the state) or 0 if not found  (n-1 or 0)
   Ç       - call link 3 as a monad  (get n-1 in other cases)
  ȯ        - logical or  (yielding n-1)
    ‘      - increment   (yielding n)
     ị     - index into the state string (get the nth character)
       Ḣ   - head the state string (get the first character)
      ṭ    - tack
        Œu - convert to uppercase
           - implicit print
e“\B“½ƈN»ȧ5ȯÇ’ - Link 3: n-5 or ... : state string
 “\B“½ƈN»      - ["Alaska","Missouri"]
e              - exists in? (1 if so, 0 if not)
          5    - 5
         ȧ     - logical and
            Ç  - call link 2 as a monad
           ȯ   - logical or
             ’ - decrement
“¿ØƈṢḍw÷S=)µZṂ÷ĿæÆɱ»Ḳiµ%2+3¢⁸? - Link 2: n = 3 or n = 4 or ... : state string
“¿ØƈṢḍw÷S=)µZṂ÷ĿæÆɱ»           - "Arizona Minnesota Mississippi Nevada Montana Texas Tennessee"
                    Ḳ          - split at spaces
                     i         - first index of state string in that list or 0
                      µ        - monadic chain separation (call that i)
                             ? - if: 
                            ⁸  -   link's left argument, i
                               - then:
                       %2      -   mod 2
                         +3    -   plus 3  - odd entries to 4: AriZona, MisSissippi, MonTana, TenNessee
                               -            even entries to 3: MiNnesota, NeVada, TeXas
                               - else:
                           ¢   -   call link 1 as a nilad
³Oḅ⁹%⁽qġ%14ị⁽"wB¤Ḥ - Link 1 ...n=2 or n=0: no arguments
³                  - program's 1st input    e.g. Iowa          or Ohio
 O                 - cast to ordinals            [73,111,119,97]  [79, 104, 105, 111]
   ⁹               - 256
  ḅ                - convert from base           1232041825       1332242799
     ⁽qġ           - 29487
    %              - modulo                      15991            20139
        %14        - modulo 14                   3                7
                ¤  - nilad followed by link(s) as a nilad:
            ⁽"w    -   9620                     V       V
               B   -   convert to binary = [1,0,0,1,0,1,1,0,0,1,0,1,0,0]
           ị       - index into                  0                1
                 Ḥ - double                      0                2
                   -   ...0th index of Iowa is 'a', 2nd of Ohio is 'h'
```
[Answer]
# Python 2, ~~94~~ 90 bytes
```
lambda s:s[0]+s[(19**9*0x4710b8f6019c1b61deca10eef13b1>>hash(s)%8199472%52*3&7)+1].upper()
```
[Try it online](https://tio.run/##XZJtT9swEID/Sr4w2oKmpjBKJw1pKtrooBQxNjR1/XBJLvUpiS/yObTZn@8SOxkakiU/53vxvZW1Vawnh/TT70MORZRAIB9lPd6cyHoQzkaj2Wi8P5@G4@gyvRiHsziMLsIEYwjHiGl4FoVXVwpEDWR4dBnOZufTydGHyejs3XR4Em7eV2WJZjA8lIa0DQooB@lpsD7@nEMEBRyfBi1K5snQH9YdZqAFpOU55JSy0eQ0c87ZQMKetcbYUlzZVrzGHHZgsOUvjRUlzuMrstl655tGT9TSIgHlYizynDST@2mhEwKfwIJ37r79l8YtalvFWd3yHVckvekSSKMHU@egE88iEKtK0FrnvqRY0Ra05yZvYevdSaQ9ZUm9yJXxzNp2n9xjZPo@3eMLJB3tghsoSlHky24fvqERrHtpiXuKuZd@sckcs7EqmIPhpnp4fbmGrEtrpch5rbK86ZQf1crgll0FD6i11PkLdFN5VJxgsJC@/O9cvYnvX17jP2HbA0H0wt43@YcF1d4/0RRN8Q6pmV73zXOzaKS31ifxjGKD/9QkMWshr625aGzdYpBYQ7ENOA2a/amKyNs/VGgsB49tgzbDw18)
(Only Python 2 because Python 3 hashes are not stable and also you can't hash a string without turning it into bytes.)
Works with all 50 states, plus as a bonus District of Columbia and Puerto Rico.
It would be possible to save one byte by writing the number in base-36: `int("5clu7x0aixb0pelmpugv5iiibphrpf",36)`. ~~I'm waiting to see if I can think of a more creative solution.~~
### Update:
Since there are 12 unused digit positions in the hash, there are 236 possible numbers which will work. It seemed reasonable to believe that one of them would have a prime factor with a large exponent. For any given prime and exponent, finding a value is quite fast; I managed to find one with a factor of 199, reducing the size of the expression needed to represent the number by four bytes.
This is basically the same procedure as [my C answer](https://codegolf.stackexchange.com/a/123030/25319) but using Python. Since the base hash function is different, I had to find a different reduction function, which turns out to be mod 52 instead of mod 54. But the biggest savings over C come from the possibility of using bignums to encode the vector, and of course the fact that the standard for Python seems to be that it's ok to use a lambda literal instead of a complete program.
[Answer]
# [Python 2](https://docs.python.org/2/), 191 bytes
```
lambda s:s[0]+("KZD"*5+"HNTD"*5+"AYY"*4+"__L_O_VTA_I__A_T_RS_KA__S_"+"MOO"*5+"I_C_"+"AE"*6+"_I_D__A_"+"EDL"*5+"HV_A"+"IR"*7+"XC"*6+"E____N__YJ_YT___L")[reduce(lambda a,x:a+ord(x)^24,s,0)%174]
```
[Try it online!](https://tio.run/nexus/python2#VVDbjtowEH33V0SRKiWEh2217UpI@xABLVluFVC2dLu1hmQgowQ7sp0F@vN0EpDaRpHnHM/xmcvu8eelhMM2A8/27MvdaxT44x8Dv/Mx8kez1RXEm43fuY98KSdyLterWCZSxnIlF0s5jqVcSj/yp/N5K05kv6Hx0O984ieJHDRavhkOJlfbtYyZJgu/8xD53/utbij5m0m5eZKbFcOJH74YzOoUg1t70D31INImC07hrw/3Xdu9C9@9f7h/vdCjgaMkVdUuCMUxpxI96gnPmTOfXmVIuWAXUBgy@1/s4SnFyjWyrUEoLnEJWziA4GgLDoZ@a9XEApQFK/pQ0k4bRSD6utQGMs1AKUwdpbUTAyzhCAbFZ05SBuILarNn9YiviUSSQa5FUpakNFmRqIyA/RN9BDG@lhijcnVanMVE12Tb9BRIIZ/mXILKGFgLaV5bdM6KKaU57UEx4D6sdqwna5u/qqjFujYMtHKN2Qy3ph1uhm@QNeHojeBQ2Zy474Y9obF4buEUT5TqFm60KcRMG5d7fTCaJ4AbHUDRVJ3npMW8KHlC3uDc4F4r8RWVsufyDZqVLXKdoZfYdoqlrv@1utKb1QqbUSwioxPv5JuDXKzRHHgGsSbeaGP3DNyz2jsu84zWeX8TZFOtLPH9WR9Y8gc "Python 2 – TIO Nexus")
Uses a simple hash function to find the second character of the abbreviation.
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~113~~ ~~81~~ ~~80~~ ~~77~~ ~~70~~ 68 bytes
```
M1!`.+[A-Zz]|...s.s?|M[io]n?t?|[AFIOUWN][^o]v?|T..|.*
\B.*(?=.)
T`l`L
```
[Try it online!](https://tio.run/##TVDRbtswDHzXV3gPA7oWFbAPGIIsQVuvdTJsaYMtyxDGZmPCshiIclIX/veUdgu0gCAexdORx4CRPJw@n11vTtnXTxt7sRpf/n1ed9ZasTLqshVdxvVFtxpfpfP75Wy9@s/rw6hbWNvZc/Pvuz0/G32zX4xZbNzm7nSaksRAeUz4MZmwa@otgRk72EI9RKk0BHpm38cKvICYCTh65OCVqn84QMEKvMc8Ut5EM0UHRwhorrRIBZhr5LBT9o0@E5m0gJJN6hx5JjGpLwhUP@UjmNvXFrfoY5NXrbnjhmQoZ0Ae9Q6tA18oEIG8bARjFJNRXtIOvAKdQzgqn0T6s9/TgLkJCtjHXmyG2zCYm@EBij4ckxuo91KSzt1nPzAItgPM8IlyHuAfDpWZcYhlMoHA6gDe0ilUfdd5SWzmlVOHusF5wB178xO9l9YdoF/Zr5ILTFIZXPzm5qPUa/omtcDeiiAqetKd3EcozQOGWj2YB9KN9nJL0Jn9LmqbJUpM3gskOXshfW@5VsoL "Retina – Try It Online") Includes all 51 test cases. Saved 32 bytes by appropriating @JörgHülsermann's regex that finds the second letter (with a tweak to support DC; edit: saved 1 byte thanks to @JörgHülsermann). Saved 3 bytes by switching to @SteveBennett's regex from his comment to @HPWilliam's answer. Saved ~~7~~ 9 bytes thanks again to @SteveBennett. The other letters are then deleted and the string uppercased.
[Answer]
# C, ~~148~~ 141 bytes
```
main(){char s[99];gets(s);printf("%c%c\n",*s,s["-2-1--561-1-62--642138364---4142--1416--67-7131-111-7-246"[*(int*)(s+1)%663694%57]-48]&95);}
```
`*(int*)(s+1)` considers the second through fifth character of the input to be an integer; that integer is then hashed into 0-56 using the hash `i%663694%57`. The hashed value is then looked up in a vector of offsets which represent the location of the second letter of the abbreviation. I chose those particular four bytes because (1) Missouri and Mississippi first differ in the fifth character and (2) some states have only four characters In C you can use the the NUL terminator byte, but nothing beyond that is reliable. (This hashes both Norths to the same value, as well as both Souths. But that doesn't matter because the associated offset is 6 for all of these.)
As it happens, that particular hash yields the correct position for the second letters of the abbreviations of District of Columbia, Puerto Rico and "Virgin Islands" (typed that way, not as "US Virgin Islands", because the algorithm insists that the first character of the abbreviation be the first character of the name).
The constants 663694 and 57 were found with an automated test; 57 was the smallest hash range I found. (The first version used 380085 and 63, but when I extended the test range I found the new one.) It seems that a slightly smaller hash exists if a code is added for "use the last character in the name"; unfortunately, C syntax for selecting the last character is too wordy to make that helpful.
There are only 8 different offsets, so they could have been stored in a 171-bit (3\*57) lookup table with three bits per entry. But I couldn't think of a way to insert those bits efficiently into the program. Hex-encoding would require about one character per four bits, plus the `0x` prefixes. I couldn't do better than 151 bytes, which is much longer than the string version. If the 171 bits could somehow be inserted as raw octets, they would occupy 22 bytes, so there might be a solution, but reading a file is clunky.
[Answer]
# PHP>=7.1, 113 Bytes
```
<?=($a=$argn)[0],ucfirst(preg_match('#[vxz]| .|owa|lask|[CGHKLPV].*|ssi?.|n(n|t|[de]$)#',$a,$t)?$t[0][-1]:$a[1]);
```
[Online Version](http://sandbox.onlinephpfunctions.com/code/4c746b5ac229a3bc9a8fb30dc93ff799605c8a80)
The strikes are match through a earlier beginning match before
`([vxz])` matches 
Arizona, Nevada, ~~New Mexico,~~ ~~Pennsylvania,~~ Texas,
`(.)` (one space before) matches New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Rhode Island, South Carolina, South Dakota, West Virginia
`[CGHKLPV].*(.)` matches California, Colorado, Connecticut, Georgia, Hawaii, Kansas, Kentucky, Louisiana, ~~New Hampshire~~, ~~North Carolina,~~ Pennsylvania, ~~South Carolina~~, Vermont, Virginia, ~~West Virginia~~
`ow(a)` match Iowa
`las(k)` match Alaska
`ssi?(.)` matches Massachusetts, Mississippi, Missouri, ~~Tennessee~~
`n(n|t|[de]$)` matches ~~Connecticut,~~ ~~Kentucky,~~ Maine, Maryland, Minnesota, Montana, ~~Pennsylvania,~~ ~~Rhode Island,~~ Tennessee, ~~Vermont~~
No match for these states so we take the first two letters
Alabama, Arkansas, Delaware, Florida, Idaho, Illinois, Indiana, Michigan, Nebraska, Ohio, Oklahoma, Oregon, Utah, Washington, Wisconsin, Wyoming
First time that I am use this [Regex Subpatter](http://php.net/manual/en/regexp.reference.subpatterns.php) `?|` with allows to store the backreferences in one.
## Support the District of Columbia
Replace `(.)` with `([^o])` +3 Bytes
[Try it online!](https://tio.run/nexus/php#VZRtT9swEMff91NEEKnJ1KHt7QqrUAo0tEkQLe1YyKYjMY3V1I5sh1KWfey9ZrZjr0yqlPp3D7773yWno7qse0@UIchLL0375xU8whb6g/75rJ8NeprwjQZTAxh@pUST75ZsgHDgCt12KIAKy7QEK7/g3EBaUQYFVSixiBCUC5w3QtFFR8eYC4Zz4dAnRwY120edZxwYM6pgBwwpdNGhS5kZF8rp0tR9hShb67Arc/1EBmEswSTsQFhAqYoJx@ZcVZhQrPoITZaQFBh0s2FsCN3po0k6tZ1P5wYgIpp8s1fovkMz2mBu0sxMXASYqAaiC3tm@wpIodDYIs7lWBqOhFA3RDYU5yVeA1EotEjKyKlQN0SxZZyrX12rnqP5gdKGaWRmEFEiuuIio3@MHpmZenxh0TNofeOlBTtnAtual1hPIp4c@DViHCkF4usDjNALzpXccXSA95RtFDJKxZSJ0gmAUTkJfVvw3jCGTddjbCRKSqwyJubuZFPJier1Tcy2JgytqZIqMZt5gwjh@@oZut28MaLelrRATsjNDG6NsHPa/F/QPHhv@FfQ3BS0QGoQHClFFrFlL3pDFt@6852AUh7vjNhLxLZyApIsLcFyc7vylqa8FUidyVroVlYWIi6cd84rM5oV5jklHGtf08hqT7cygSJS614G3MWkboT/q5Ivm@cCW5OBK8OEbNU/64zD3ujr2@noTJrPtIeffsoGTf6EmYzxaqntzy0I@enoH3uj1kufX14zv3W89AeVT7rzwG/l98Pb@G0aXE2ms5tldvLBO/FbuZgj9SQeaUWbFihzff@4P3Bh4Ap/5IovLvjp58wfvqG8pEcPwhYn/6lSHsjR8PfbH0I/5vIlQX8B "PHP – TIO Nexus")
# PHP, 150 Bytes
```
<?=($t=preg_replace("#.\K\w+ |las|ri|nec|eorgi|awa|ow|[aio]ni?|e(?=n|v|x)|ntuck|ouisi|a?in|arylan|issi?|nnsylv|erm|irg#","",$argn))[0],ucfirst($t[1]);
```
[Try it online! Testcases](https://tio.run/nexus/php#VZNvb9owEMbf8ykQRQI0NG2vWxZV0JaUJqkKhXWApmtwiUWwI9spZfM@e@c/59FJeRH/bJ@fe@7uIqqKqvHCBYG86C6XncsSnmEPnX7n8q6z7jcckTsHJggE/cWZIz8C2QGTIC168GgIJTVhGbXnhpcIeckFbLhFWUCMkVzRvFaWzjwdkRIOIIhBoyuPrs1VurHRrlHYDeFi6@LfYPyxuUSpAePYg3gDhX0tHuG6LCnj1AqNMUrMNhRcNnGKhB/cEoNOQmqTKQLCVJ3vjhY9eXTHayoxzB3eS4Aym0ByFdbiWALbWDQKSErjey2JUvaFJFyleUG3wCyKAzI@Sa7sC0kamJT2qyqbczI9UV4Lh9DkhDPlxSVocEqeBZY1vQroFZy/6TyAQ3MM@0oW1FUiHZ/4LRGSWAfS2xNMyBvNrd1pcoJPXOwsQqdSLlTRHILgphLuteHHjRHsfI4pWpQV1EbM8O1sV5qKuv7MsB0zQbbcWpVh690TxuSxfAXffPdo6kPBN6QZS6zBAxo75fX/gqbDjxv/BE1R0IzYQkhiHZmlgb25Dpl99@tHBYVZPqLZcyL2pgKGzAOhpnO9vDnKW4DxmW2VS2URIJGq@eHwAkuzoDLnTFJ3FhNZHPneBLDEeN1Yg2xTVtWq97ukUnXbILas3zbXlEm1N/Cb543o2/tFNOi21aAyRv4UpCohJ93W2efVZHX41NRm/LWg2kypdgOnzZBpftBLoHzNaKRJNxow/arfetoNhnbDoCGiTPue17ZLI@3Loo0b2qR01uq3Wn0nq9dbfln36/yFCqtULb@ue@fvJC94a6WCZPNnz65Y6/zP@18 "PHP – TIO Nexus")
[Answer]
**PHP, ~~887~~ 854 bytes**
```
<?=array_combine(['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming'],['AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY'])[$argv[1]];
```
[Try it online!](https://tio.run/nexus/php#VVLRjtMwEPyVPiAVpHvhGRA6tXDN9Zyc2tJQqgptE5Osknor22kv/HzxOOEEUjSZ9c6OvWvfPn7@RNZS/7OQ05GNfruf3rd0pBNN78BcE4nl32IG1pBx5AKdUcu/xBrG@kxasVRKpMbownPR@RDNdUtXsjrQr0HCJdQPWmwV6xYhyRxIUlKN6qRt2Qhjg8SUTHHXRK74Lf9uvdTGd0XTB/okHbtRpih0EP@2b8mUkTpHRd057T0qFRc1V2QiDed04mMlO4fvfOYxks5GKsYP5qk@2nEcqb5QOZDrZEGns6s5doj4UVun@zFQ@oULGYOd2AZUrK8nM7ISOqXXhTk1w1mymlGRNW2YSLyHzOpKcORnbYzr2wsNQ1/VUupJ4sZe19L9bzwsvBpvNBp2Wkf@Eif5zVMdflttT6FTMA43M9jnFPoylY9b59r5yb9JdoUYxzHXyykIp4e78Hqe8EqWgB@AFV7EPSADbPAkvuAxQPeAxCLBDc8BWEtSABLLNWCHS0aoUKagUzFEmYJYQadgr2CfQpduAQvAI0ABYJXOAHDJkM1w0gyHfIbpCqZrSNaQbGC/@Y45wXkbAbo8AvbIUZHvpod3@zdkq8v@/eHw4Xa7jRP9Aw)
*First timer, hooray!*
[Answer]
# C, ~~945~~ ~~937~~ ~~718~~ ~~711~~ ~~660~~ 616 bytes
[Saved 219 bytes thanks to ASCII-only.](https://chat.stackexchange.com/transcript/message/37664941#37664941)
```
struct{int*a,b;}m[]={"laba",76,"lask",75,"rizo",90,"rkan",82,"alif",65,"olor",79,"onne",84,"elaw",69,"lori",76,"eorg",65,"awai",73,"daho",68,"llin",76,"ndia",78,"owa",65,"ansa",83,"entu",89,"ouis",65,"aine",69,"aryl",68,"assa",65,"ichi",73,"inne",78,"issi",83,"isso",79,"onta",84,"ebra",69,"evad",86,"ew H",72,"ew J",74,"ew M",77,"ew Y",89,"orth",67,"orth",68,"hio",72,"klah",75,"rego",82,"enns",65,"hode",73,"outh",67,"outh",68,"enne",78,"exas",88,"tah",84,"ermo",84,"irgi",65,"ashi",65,"est ",86,"isco",73,"yomi",89};
i;char b[99];main(){gets(b);putchar(*b);for(;m[i].a;i++)if(!strncmp(m[i].a,b+1,4))puts(&m[i].b);}
```
Newline unnecessary, only for display purposes. Takes the state as input. [Try it online!](https://tio.run/##PZLBTsMwDIbvPMXIAbVbQDDG1qriwA2QeAA07eC2WWOtTaYkZYxpz16cJtvtk@3/9x@31X1TVcNgnekrd0LlpsDL4tytN68n1kIJjK@WnMjuiF44M/inGc8fiXagGM/mnEGLW8aX1NWtNjSXEyklqLvgTLRwoC7VqInBT2jTBAUcwNeeOatBkvMyo7kWVZhTNfoEVNMHiAJliTISCOV6Ir@sRxu76Nf6ZWCObbADa6MWKxmX4RjPG6O1GPyI9CW8gxi@NBD8xA/UVPPhD5N3mpuP9Em0GOmLaDXSd0xlnCTt6kq0TaIO0l0LMl5UNDrcUSgVnyF1LUJQ3V9N@ouJuIYXv0CKjMh5uzGx6XQgNA3Gq1gZSVg3Ca9AW@mw4qg7f4H8XNxgUUkwk3Kd55uio2Mm6akRziZlWux755vJlHirTVJ0a9w8QIGzWYrb5Jb@IVV1@ySUeTl74os0JZVN7sYa6c7D8OG/8/Dm/60OhuEf)
How it works:
* `struct{int*a,b;}m[]=...` declares a map `m` with two values - a four-byte string and one character. This is used in the comparison loop, which compares the second through fifth indexes with `char*a` in the map.
* `gets(b)` reads a string `b`. This will be the state to abbreviate.
* `putchar(*b)` prints the first character of that string, since each abbreviation starts with the first letter of the state.
* `for(;m[i].a;i++)` loops through each value of the map. (This might be able to be shortened.)
* `if(!strncmp(m[i].a,b+1,4))` compares the current map value to the second through fifth characters of `b` (the state to abbreviate). This is because the only differences are in the first five characters, but we've already printed the first character.
* `puts(&m[i].b);` prints the second letter of the abbreviation (if the state name matches with the current map value), and a newline.
[Answer]
# [Actually](https://github.com/Mego/Seriously), 181 bytes
```
2"OHCALAGAMAWVFLNVILMNMOMIRINCDEMTMEINWANYTXORNEOKIDAZNMUTNDMDVAKYSDPAARWYNHIAMSALNJAKTNHIKSVTWICOSCCT"╪"âäà♠îÉæô↨→←∟♣áíå*,▓/12│┤94▼╛?DE╞G╚╠╬ST╒WXßb;Θoq╙|⌂"♂┘Z⌠i≈┐⌡MXO;rR5♀ⁿ*:236@%└
```
This solution expects input as a quoted string.
[Try it online!](https://tio.run/nexus/actually#VZFNb9MwGID/ShWJyzQJMT4k2AGipGuzNsnUZs26m5eYxmpqDzvdVsQBdpg2qYdpNNMKEutgIISAE0ckDrnzI94/UmynTCBZep/3@8Mwns1XDL9umU2zZrpm2Flreh2n6Xqu7zotx7Psqhu4VccLTa8bbPktr@o3HNvc9tzNwLNdu2M2um17wzRbYderO6bbNpveutkIpNJod4LQsfy2ZQUG5F@M4n1xXcxgOiu@FyfFp@IHHH2GozM4OoXjS5h@KK6Kb8XHpWU4f337zgpMDmFy/fAenP@E/O1juwr5uxrkbyCfQf61HUB@Fm4Vlzurvy/YM8inL2B8aMBUJl1sw3hG4OQYJqcwvnK3/FXeug/Tl/Dq19KjlbsPntyCyWSuXGRumCnaQQNkLCsSfQ2cPGe0pD6iAgmJFkrJU8YpUXaLpYyjmGmkFEcZiYaZ1Gycon3EscQ1GUJiFV3DjPd0Xl06CZHgxChR2U6aEsqIauDQmCDd1WH7SjT@tm5gmg2j/khikw2JWIS5iFCsJR@liMYahUBRMhQ4y1SmS6KE9BDVKOcULNOZRAj1dnfJQmNDrpHRrCzu4R2@OIeH91Bcwn6ljga7IiF6Q6WvYy7waKG4@IBEbKF0Ge8rZDxLKhbiTG6Kbgw26pez@AlRGX4/lRfR/@Bz3GNq5A1MqRile6g8eithMa44YrFrmw3/L1wabgoHWC0sMNZ8oC@5maFEig7mA7mpIiJ/piwfIrkX7WW6dYhFVvnXSUTEqCDaN2IDGWj8AQ "Actually – TIO Nexus")
## Explanation
This solution utilizes the same hashing strategy as my [Python 3 solution](https://codegolf.stackexchange.com/a/122906/45941). For brevity, I am going to omit the explanation of how the hash is computed and why it was chosen (go read the other answer if you want that bit).
Also for brevity, I'm going to be leaving out the contents of the very long strings, since otherwise the explanation would be unreadable.
```
2"..."╪"..."♂┘Z⌠i≈┐⌡MXO;rR5♀ⁿ*:236@%└
2"..."╪                                state abbreviations (push the long string, split into length-2 chunks)
       "..."♂┘                         hash values for the state names (a string of CP437-encoded characters, converted to their CP437 ordinals)
              Z                        zip the two lists
               ⌠i≈┐⌡M                  for each pair:
                i                        flatten the pair
                 ≈                       convert hash value to int
                  ┐                      store abbreviation at the register numbered by the hash value
                     X                 discard the now-empty list
                      O                convert input string to list of ASCII ordinals
                       ;rR             range(len(ordinal_list)), reversed
                          5♀ⁿ          5**i mapped over that range
                             *         dot product of powers of 5 and ordinal list
                              :236@%   mod by 236
                                    └  push value in that register
```
[Answer]
# [Python 3](https://docs.python.org/3/), 230 bytes
```
lambda s:chr(s[0])+'IA%%L!NOI!M%!E.N!Y.XR.Z$D.I!.D$DA.D%!.HA!LJ%.N%‌​$T.I%!C!T!.HAAT$.A!.‌​VL.V%$CE%%AEK%.T$!.Y‌​.A!.R.Y$O.S%!.K$!.S'‌​.replace('%','$$').r‌​eplace('$','!!').rep‌​lace('!','..')[sum(c‌​*5**i for i,c in enumerate(s[::-1]))%236-5]
```
[Try it online!](https://tio.run/nexus/python3#TVDbTttAEH3fr/BKtmynsOpF9CFSH6yEFpNbRdLQlPIw2Es8ir1r7ayB9Ofp2CCBZHnOnJ3bOfff/j7X0NyVENC4qFxCNx9v0w9xnkXRXC5XuVxE8lwt5U79vlJ/wqnKpZqG00xNI6kuMjm/jNQyCjcqj@REbnou24Qqk2o7V9sonJxHUXY@i9QmlGrX81dqF67UmttnTK1j5XRbQ6GTOIpP4jCM0zcmZEbK94xkRqk4vaGuSYrR2WiEwb11AZ4UAZpAm67RDrxmIePx6afbNI0@f/l6enb7jE1rnQ/oSKJvIM9VfQsTinyJhpdAmaSK2hp9jUZTko5FELQOjU/uk6FDaVPYUidpmj5nNdxBA4IjHTg4/GdNHw9gCEhMoEZeZRDExNbWQWkZGKMLj0XnxVTX8AhOi@/8iCWIH9q6PVdfMI0o8hIqK/Kab7FIIjclAs/P7SOI2cuKmTa@Kw5HMbcd0vC8AD6d/@5YgykZEEFRdaS9J7HAosI9GAZ8B1nP9UjUf22LA7adY2CN74ct9Z0bxC31A5R9eAwuoGmpQr67zy61I30c4EI/YWEHuLPuIJbsdxVMwFlWAK/pFA791lWFVqwONStkB1dO760RP7UxdKwfoLfsqmKfg5wGFWvbvR/1kr6O2uheCmnN6Ik9@eWhElvtGtYgtsiO9uOugW82e89rrjX54O0BqbCGkPmjbbjkPw "Python 3 – TIO Nexus")
Input is expected as a bytes object (a byte string, rather than a Unicode string).
Thanks to Johnathon Allan for an absurd amount of bytes
## Explanation
Each state name is hashed to an integer `a` by applying the hash `a = sum(o*5**i) % 236` (where `o` is a character's ASCII ordinal and `i` is its index in the string, counting back from the end). The modulus `236` was chosen because it is the smallest modulus that causes all hash values to be distinct for the 50 US state names. These hashes are then mapped to the state abbreviations, and the resulting dictionary (compressed using string substitution) is used to look up the abbreviation given a state name (hashing it to get the appropiate key).
[Answer]
# [Python 2](https://docs.python.org/2/), ~~131~~ 125 bytes
```
lambda s:s[0]+'CLLKARADEZVAK.T..DETTH.NSAHY...ID.D..O..Y.IRE.X..NALINC.VJM.SY.T..AAOI'[int(s[0]+s[-2:],36)%386%334%181%98%70]
```
[Try it online!](https://tio.run/nexus/python2#XZFbb9owFID/Sl4iWo1Z7ZhaWmkPEWEj5TYBpWOMh0NiyFESn8h2StmfZ7GdrNokS/7O/Xb48uuSQ7FPwFOPanuz@9AZTCbjYBGEw5/rYMxWjIXD1WrEZstgtGGMRSELGZsztmHRYsh@MDYLJtFswNZPU7bcmIAgmEedLQp9ZTOq7cdPj7tu7@7a7/Xv/F7vs3/bv/Uf@v79ze5SytrRK6C8OnS9bSfIYQ8FdLqeQZU5kvibRIMZCAXK8AByPJAUaC0DyklCQo6F4LHGuNJGDHkOJ5Dc8NfaCxMb8Y2TPLrgUW1HNBQlkNocUZ6jILSVIpEguAYiOtl//LeNMRe6irOz4QlVqFrXKaDgDuQ5B5E4VgritFJcaxs@xTjFIwjHdd@KtAtHpcwrS2xFqqRjEropMuN72e5pxl8haejkjaAoVYpubKN44lLxcytN@RvG1Eobkpllkjr1BiCpnh7eNSFkTVvzFG3UPMvrTblTzSU/kp3gOxdCnfNXaK6ySCnhXqTa8ZdU/Zffad7zr7jZgeLcCW9uyc8aUvOvuSzq4S1ifb2mzAvUk4qjdk28cKW9f8yoYhIKnfVMRe3b2V1f/gA "Python 2 – TIO Nexus")
`int(s[0]+s[-2:],36)` generates a unique large number for each state by parsing the first and the two last characters as a base 36 integer.  
`%386%334%181%98%70` is a modulo chain generated by a search program that reduces the size of the numbers while not mapping two states with a different second character in the abbreviation to the same number.  
These smaller numbers are then used to index into the string `'CL ... OI'` to get the second character of the abbreviation.
[Answer]
# [Python 2](https://docs.python.org/2/), 152 bytes
```
lambda s:s[0]+'.NY.SDS...O.DT..RT.AAYJZE.K.I.X.TI.EL.CMI..E.NA..L....TH.......O....DAAC..VNH.YAI.RVDA..L....A'[int(s.replace(' ','')[1:],36)%358%235%95]
```
[Try it online!](https://tio.run/nexus/python2#VVDRjtpADHzfr8jLCVBPVltEdUW6hwhoyQGhAsqVUlSZxBArYTfa3RzQn6cOXNU2iuzxejT2ePf441LgYZti4Lpu/XbzpgHxCub9OQBMob8AmC0gDFdP3wcwggi@wSKCwRh6kwhgAHEIMBYqLIZw@6Z16IdhD2AZD2EVRjBb9v/QwsaatW86sFQWmFCzETTuG43W@l13c9/@0Lprdx7u3rc7dx87mws/Wjz@ZF1WvtlSx4wLCrirAm/PEoPS1lK7JrdaUv1PDuiUUOlr2tYS5pewwC0eUEl2uSTLv4yuc47aoVM9LHhnrGZUPVMYi6kRoDUlnpPKqz4VeERL6pM0OUX1mYzdC3soz8wqSjEzKioK1oadinTKKPqROaIa3UaMSPsqyc9qbCp21/YEWZNEey5QpwKcwySrHHnv1ISTjPeoBcgeznjhs3P1X5Z8xaayAoz2tVhMW3s1F9MLpnU6BkM8lC5j2buunsg6Ol/hhE6cmCtcGZur2FifBT20Rhzga9nHvJ46zdioaV6IQ7ng1NLeaPWFtHbn4gXrk80yk1IQuauLuan@lbqVr1ILqq04IkEnuclXj5lakj2IB7VkuWgt94yys957GfNMzgd/G@wSox3L@9kchPIb "Python 2 – TIO Nexus")
A port of [Arnauld's answer](https://codegolf.stackexchange.com/a/122918/39244).
[Answer]
# Ruby, ~~106~~ 103 bytes
```
->s{s[0]+(s=~/ /?$'[0]:s[(j="()6>P_ac;?.O}AFLKMrS".index((s.sum%136%95+32).chr))?j>7?j/4:-1:1]).upcase}
```
If the input contains a space, the second output letter is the one after the space. Else...
Hash the sum of all characters in the input to obtain a character whose index in the magic string indicates the index of the second output letter in the input string, according to the formula `j>8?j/4:-1` (-1 means the end.). If the hash gives a character that is not in the magic string, second letter is second letter of input.
As an explanation of the magic string, the hash characters and the letter indexes they encode are below. Note that Delaware appears even though the second letter would do - this is because its hash code clashes with Kentucky. Fortunately the last letter of Delaware is the same as the second.
```
Letter(index)
Last  (-1)  (-MD    )-VA    6-GA-LA  >-DE-KY    P-PA    _-CT    a-KS    c-VT
3rd    (2)  ;-TN    ?-MN    .-TX     O-NV
4th    (3)  }-MS    A-IA    F-MT     L-AZ
5th    (4)  K-MO    M-AK    r-ME     S-HI 
```
**Ungolfed in test program**
```
a="Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming".split($/)
f=->s{                                                            #String argument s.
  s[0]+(                                                          #Return character s[0] +
    s=~/ /?$'[0]:                                                 #if s contains a space, 1st character after space, ELSE
      s[(j="()6>P_ac;?.O}AFLKMrS".index((s.sum%136%95+32).chr))?  #if (sum of ascii codes, mod 136 mod 95 +32).chr in the magic string
        j>7?j/4:-1:                                                 #return s[j/4] if j>7 else return s[-1] ELSE
      1]                                                          #if not in the magic string, return s[1].
  ).upcase                                                        #Convert the second character to uppercase if needed.
}
a.map{|i|p [i,f[i]]}
```
[Answer]
# [///](https://esolangs.org/wiki////), ~~619~~ 608 bytes
```
/2/~M//@/~South //1/~North //!/~New //~/\/\///Alabama/AL~Alaska/AK~Arizona/AZ~Arkansas/AR~California/CA~Connecticut/CT~Delaware/DE~Florida/FL~Georgia/GA~Hawaii/HI~Idaho/ID~Illinois/IL~Indiana/IN~Iowa/IA~Kansas/KS~Kentucky/KY~Louisiana/LA2aine/ME2aryland/MD2assachusetts/MA2ichigan/MI2innesota/MN2ississippi/MS2issouri/MO2ontana/MT~Nebraska/NE~Nevada/NV!Hampshire/NH!Jersey/NJ!Mexico/NM!York/NY1Carolina/NC1Dakota/ND~Ohio/OH~Oklahoma/OK~Oregon/OR~Pennsylvania/PA~Rhode Island/RI@Carolina/SC@Dakota/SD~Tennessee/TN~Texas/TX~Utah/UT~Vermont/VT~Virginia/VA~Washington/WA~West Virginia/WV~Wisconsin/WI~Wyoming/WY/
```
[Try it online!](https://tio.run/nexus/slashes#PZHhbuIwDMdfBZ7Aok9A1bKRlaYTdPQ43RevZNRqSVCSjrEPfnXO5U5TIuVnObbz/@cOCXAJsATeuTF2M4AFsHb@gXNBcxVg@CMLIB3wHc8I6YYFQy9UcOrp21nB34I92oAB0i1nONCH85YQspQzZ61pI7VjhKzm3Ax4RW8gX/HT4DwdEZ42/GycP0nBc8pryRPBWrE6YudA5ayGgayjAGrDyh4JZajSrNxVzpSLf6OLHRfGxrHtb1AceONGCo@rmzRBsgbKVYL@NqA9QpknGAK23RhMjAHKNKG2oxNaKFVC8uTgIkKpEwph2pcLQbmbIjd6wSpxNk7Ny1qsevcPT/RK@BNFkt7P13i@hI5Eql7PX4wP5gb6ZV6aL2od6HJ@cL4HfVhk6J3ok6JskWM/zdU5Vx05qNZc9YO4INZXBVfenJyFasuvxtpwGz5xcvk15W3njmamwkPcVi1/eu6y5f@eu5xrMwkLxkCtJfgS0@pf/Baxg7ea98afRRTsBUl@Y2q9T7lBUWFPUQY3EpkQZz/pZs8NhdbZQJJV3NzcWe5Cc4D7/S8 "/// – TIO Nexus")
Since there is no other way of taking input in ///, it goes at the end of the program. Just append the desired input to the program.
Saved 11 bytes by making more replacements, as recommended by @SteveBennett
[Answer]
## Mathematica, ~~138~~ ~~140~~ 134 Bytes
+2 bytes - found a mistake (needed array offset of 1 not 0)
-6 bytes - found a better hash
`#~StringTake~1<>"R_ATE__IN_COI_J_I_SLNAT_Y_Y_HKOAE__SAA_DDLM_RVAH_XDTVA__I_N_EA_T_DY_C_KZL"~StringTake~{1+Hash@#~Mod~89866736~Mod~73}&`
Similar to others it takes the name and takes the first letter. Then it applies the default Mathematica hash then applies two modulus to it "`Hash@#~Mod~89866736~Mod~73`" to get a unique number for each state. This value is then looked up in a string to generate the second letter.
Can probably be golfed more but the search space is huge for Mathematica to find. Duplicated second letters weren't considered in the hash search. `_` characters represent wasted values in the string. In theory you could get the string down to only 19 characters but finding the custom hash to produce that would be a nightmare.
[Answer]
# [TAESGL](https://github.com/tomdevs/taesgl), 386 bytes
```
B=«ōďā,AL,ņćđ,AK,ķċđ,AZ,ćōē,AR,ďċđ,CA,ĭāď,CO,ŕĭ,CT,ćđēą,DE,ĕŕ,FL,īĭ,GA,ńāē,HI,ćĉďą,ID,ĭċď,IL,ľđā,ţ,ńĕĕ,IA,ķő,KS,ŏĝ,KY,ŏĕĕ,LA,ŏđć,ME,ņāē,MD,ńđā,MA,īđą,MI,ļēď,MN,ŕğ,MS,ňė,MO,ććĕĉ,MT,ćċćĉ,NE,ŕēď,NV,ň ćŋā,NH,ň ĩēđ,NJ,ň ğĕċ,NM,ň ĉĝ,NY,ćņ ġĉă,NC,ćņ ńċą,ND,ĩēą,OH,ŋĺ,OK,ļķ,OR,ĺđď,PA,ĉĉğ đēā,RI,ōċ ġĉă,SC,ōċ ńċą,SD,ňďą,TN,ċĕď,TX,ōđą,UT,ćđāā,VT,ğğ,VA,ďĉē,WA,ĉĉć ğğ,WV,ľēđ,WI,ĉĩĕ,WY»Ĵ",";B[BĪA)+1
```
[**Interpreter**](https://tomdevs.github.io/TAESGL/v/1.4.1/index.html?code=Qj2rXHUwMTRkXHUwMTBmXHUwMTAxLEFMLFx1MDE0Nlx1MDEwN1x1MDExMSxBSyxcdTAxMzdcdTAxMGJcdTAxMTEsQVosXHUwMTA3XHUwMTRkXHUwMTEzLEFSLFx1MDEwZlx1MDEwYlx1MDExMSxDQSxcdTAxMmRcdTAxMDFcdTAxMGYsQ08sXHUwMTU1XHUwMTJkLENULFx1MDEwN1x1MDExMVx1MDExM1x1MDEwNSxERSxcdTAxMTVcdTAxNTUsRkwsXHUwMTJiXHUwMTJkLEdBLFx1MDE0NFx1MDEwMVx1MDExMyxISSxcdTAxMDdcdTAxMDlcdTAxMGZcdTAxMDUsSUQsXHUwMTJkXHUwMTBiXHUwMTBmLElMLFx1MDEzZVx1MDExMVx1MDEwMSxcdTAxNjMsXHUwMTQ0XHUwMTE1XHUwMTE1LElBLFx1MDEzN1x1MDE1MSxLUyxcdTAxNGZcdTAxMWQsS1ksXHUwMTRmXHUwMTE1XHUwMTE1LExBLFx1MDE0Zlx1MDExMVx1MDEwNyxNRSxcdTAxNDZcdTAxMDFcdTAxMTMsTUQsXHUwMTQ0XHUwMTExXHUwMTAxLE1BLFx1MDEyYlx1MDExMVx1MDEwNSxNSSxcdTAxM2NcdTAxMTNcdTAxMGYsTU4sXHUwMTU1XHUwMTFmLE1TLFx1MDE0OFx1MDExNyxNTyxcdTAxMDdcdTAxMDdcdTAxMTVcdTAxMDksTVQsXHUwMTA3XHUwMTBiXHUwMTA3XHUwMTA5LE5FLFx1MDE1NVx1MDExM1x1MDEwZixOVixcdTAxNDggXHUwMTA3XHUwMTRiXHUwMTAxLE5ILFx1MDE0OCBcdTAxMjlcdTAxMTNcdTAxMTEsTkosXHUwMTQ4IFx1MDExZlx1MDExNVx1MDEwYixOTSxcdTAxNDggXHUwMTA5XHUwMTFkLE5ZLFx1MDEwN1x1MDE0NiBcdTAxMjFcdTAxMDlcdTAxMDMsTkMsXHUwMTA3XHUwMTQ2IFx1MDE0NFx1MDEwYlx1MDEwNSxORCxcdTAxMjlcdTAxMTNcdTAxMDUsT0gsXHUwMTRiXHUwMTNhLE9LLFx1MDEzY1x1MDEzNyxPUixcdTAxM2FcdTAxMTFcdTAxMGYsUEEsXHUwMTA5XHUwMTA5XHUwMTFmIFx1MDExMVx1MDExM1x1MDEwMSxSSSxcdTAxNGRcdTAxMGIgXHUwMTIxXHUwMTA5XHUwMTAzLFNDLFx1MDE0ZFx1MDEwYiBcdTAxNDRcdTAxMGJcdTAxMDUsU0QsXHUwMTQ4XHUwMTBmXHUwMTA1LFROLFx1MDEwYlx1MDExNVx1MDEwZixUWCxcdTAxNGRcdTAxMTFcdTAxMDUsVVQsXHUwMTA3XHUwMTExXHUwMTAxXHUwMTAxLFZULFx1MDExZlx1MDExZixWQSxcdTAxMGZcdTAxMDlcdTAxMTMsV0EsXHUwMTA5XHUwMTA5XHUwMTA3IFx1MDExZlx1MDExZixXVixcdTAxM2VcdTAxMTNcdTAxMTEsV0ksXHUwMTA5XHUwMTI5XHUwMTE1LFdZu1x1MDEzNCIsIjtCW0JcdTAxMmFBKSsx&input=Ik1hcnlsYW5kIg==)
Very simple compression of the state names, added into an array with the abbreviations.
[Answer]
# Japt, 383 bytes
The compression of the first string may be improvable by experimenting with the order of the letters.
```
g +`lkzÇUaidlnyaÀÍ¥evhjmycdhkÎödnxttaaviy`g`alabaµ
Ã2ka
iza
kÂ6s
Öâfnia
åªv
¬n×©
Ü.Ø
fÓQ»
gegia
°ii
i»
ÅJno
Äa
Å0
kÂ6s
kÀ_cky
lia
Úpe
æ¯À
ÚUaÖ³etts
Úòig
·nÌta
æ«7ppi
æ¬
Úa
ßka
va»
w mp¢i
w jÀ y
w ´xi¬
w yk
Íh ÖÚ¦na
Íh »kota
oo
oklaÊá
eg
pnsylvia
r¸ Ó
Ñh ÖÚ¦na
Ñh »kota
âÊte
x
©ah
vÚ
virgia
Øgn
ØÙ virgia
æÈ;n
wyÇg`·bUv) u
```
[Try it online](http://ethproductions.github.io/japt/?v=1.4.4&code=ZyArYGxrep/HVWFpZGxuhnlhwJ7NpWV2aGpteWNkaGvO9mRueHR0YWF2aXlgZ2BhbGFiYbUKwzJrYQqHaXqNYQqHa8I2cwrW4maObmlhCuWEqnYKrG6a1x6pCtwu2BgKZtNRuwpnZY5naWEKlbBpaQppu5cKxUpub4kKxAGEYQrFMAprwjZzCmvAX2NreQpsjIlphGEK2nBlCuaJr8AK2lVh1rNldHRzCtryaWeECrduzJx0YQrmmKs3cHBpCuaYrAEK2ouEYQqa35prYQqadmG7Cpp3IJVtcKJpnAqadyBqwCB5Cpp3ILR4aawKmncgeY5rCs0WaCDW2qZuYQrNFmggu2tvdGEKb5ZvCm9rbGHK4QqOZWeNCnCBbnN5bHaEaWEKcpe4IInTgArRAWgg1tqmbmEK0QFoILtrb3RhCuIQynRlCpJ4hgqpYWgKdoDaiwp2aXJniGlhCtgSiGeRbgrY2SB2aXJniGlhCuYIyDtuCnd5xxhnYLdiVXYpIHU=&input=IkFsYWJhbWEi)
[Answer]
# Perl 5, ~~150~~ 148 bytes (147 + 1)
This is by no means optimal, but it does its job. Needs `-n` command line flag.
```
s/las//;s/ai?n//;s/[oie]n|ri//;s/e([vx])/$1/;s/issi?//;s/(.).+ /\1/;/(.)(.)/;/^([^W]).*(?:[cogavn][wiku]|[ir][ys][li]|rm)([adyti])$/;print uc"$1$2"
```
]