How good am I at CS:GO? Your task is given an input string of the full/short name of a CS:GO (Counter-Strike: Global Offensive, a computer game) rank return an integer from 1-18 representing the rank number. A higher number means you are a higher rank and so "better" at CS:GO.

Input

A string representing either the full name or short name of the CS:GO rank. Your code must be able to handle both cases.

Output

An integer representing the rank number of the given input. You can output in either 0-indexing or 1-indexing as 0-17 and 1-18 respectively.

Test cases:

The test cases use 1 - 18 as the output, just subtract one if you are using 0-indexing. Where SN means short name.

Full name                     SN   -&gt; output

Silver I                      S1   -&gt; 1
Silver II                     S2   -&gt; 2
Silver III                    S3   -&gt; 3
Silver IV                     S4   -&gt; 4
Silver Elite                  SE   -&gt; 5
Silver Elite Master           SEM  -&gt; 6
Gold Nova I                   GN1  -&gt; 7
Gold Nova II                  GN2  -&gt; 8
Gold Nova III                 GN3  -&gt; 9
Gold Nova Master              GNM  -&gt; 10
Master Guardian I             MG1  -&gt; 11
Master Guardian II            MG2  -&gt; 12
Master Guardian Elite         MGE  -&gt; 13
Distinguished Master Guardian DMG  -&gt; 14
Legendary Eagle               LE   -&gt; 15
Legendary Eagle Master        LEM  -&gt; 16
Supreme Master First Class    SMFC -&gt; 17
Global Elite                  GE   -&gt; 18
JavaScript (ES6), 164 150 135 bytes
s=&gt;'GE S1|S2|S3|S4|SE|SEMGN1GN2GN3GNMMG1MG2MGEDMGLE LEMSMFC'.search(s[r='replace'](/[a-z ]/g,'')[r]('IV',4)[r](/I+/,a=&gt;a.length))/3||18

(Saved a bunch of bytes thanks to @Craig Ayre and @Steve Bennett.)
Explanation:
s[r='replace'](/[a-z ]/g,'')[r]('IV',4)[r](/I+/,a=&gt;a.length) converts Full names to the SN equivalents.  It doesn't change SNs.
We then simply index into the array of SNs created by split.
Snippet:


f=
s=&gt;'GE S1|S2|S3|S4|SE|SEMGN1GN2GN3GNMMG1MG2MGEDMGLE LEMSMFC'.search(s[r='replace'](/[a-z ]/g,'')[r]('IV',4)[r](/I+/,a=&gt;a.length))/3||18

console.log(f('Silver I'));                      // S1   -&gt; 1
console.log(f('Silver II'));                     // S2   -&gt; 2
console.log(f('Silver III'));                    // S3   -&gt; 3
console.log(f('Silver IV'));                     // S4   -&gt; 4
console.log(f('Silver Elite'));                  // SE   -&gt; 5
console.log(f('Silver Elite Master'));           // SEM  -&gt; 6
console.log(f('Gold Nova I'));                   // GN1  -&gt; 7
console.log(f('Gold Nova II'));                  // GN2  -&gt; 8
console.log(f('Gold Nova III'));                 // GN3  -&gt; 9
console.log(f('Gold Nova Master'));              // GNM  -&gt; 10
console.log(f('Master Guardian I'));             // MG1  -&gt; 11
console.log(f('Master Guardian II'));            // MG2  -&gt; 12
console.log(f('Master Guardian Elite'));         // MGE  -&gt; 13
console.log(f('Distinguished Master Guardian')); // DMG  -&gt; 14
console.log(f('Legendary Eagle'));               // LE   -&gt; 15
console.log(f('Legendary Eagle Master'));        // LEM  -&gt; 16
console.log(f('Supreme Master First Class'));    // SMFC -&gt; 17
console.log(f('Global Elite'));                  // GE   -&gt; 18

console.log(f('S1'));
console.log(f('S2'));
console.log(f('S3'));
console.log(f('S4'));
console.log(f('SE'));
console.log(f('SEM'));
console.log(f('GN1'));
console.log(f('GN2'));
console.log(f('GN3'));
console.log(f('GNM'));
console.log(f('MG1'));
console.log(f('MG2'));
console.log(f('MGE'));
console.log(f('DMG'));
console.log(f('LE'));
console.log(f('LEM'));
console.log(f('SMFC'));
console.log(f('GE'));