With so many unusual and contradictory grammar rules, the English language has many twists and turns. But the same holds for many of the words in an English dictionary.

Scrabble
Letters from the Scrabble game.

The word cabbageheaded is the longest word that consists entirely of letters from the first half of the alphabet (am). The word nontortuous is the longest word that consists entirely of letters from the second half of alphabet (nz).

We can also search for words that alternate between letters from the first half and the second half of the alphabet. The longest alternating words starting with a letter from the first half of the alphabet have 12 letters. Examples include comparatives and itinerariums. The longest alternating words starting with a letter from the second half of the alphabet have 13 letters. Examples include paranephritis and phraseography.

Assignment

A word only consists of uppercase and lowercase letters. Your task:

None of these functions may make a distinction between uppercase and lowercase letters.

Example

>>> position('G')
7
>>> position('v')
22

>>> first_position('FIDDLEDEEDEE')
4
>>> first_position('soupspoons')
14
>>> first_position('CoMpArAtIvEs')
1
>>> first_position('pArAnEpHrItIs')
1

>>> last_position('FIDDLEDEEDEE')
12
>>> last_position('soupspoons')
21
>>> last_position('CoMpArAtIvEs')
22
>>> last_position('pArAnEpHrItIs')
20

>>> isfirst('FIDDLEDEEDEE')
True
>>> isfirst('soupspoons')
False
>>> isfirst('CoMpArAtIvEs')
False
>>> isfirst('pArAnEpHrItIs')
False

>>> issecond('FIDDLEDEEDEE')
False
>>> issecond('soupspoons')
True
>>> issecond('CoMpArAtIvEs')
False
>>> issecond('pArAnEpHrItIs')
False

>>> isalternate('FIDDLEDEEDEE')
False
>>> isalternate('soupspoons')
False
>>> isalternate('CoMpArAtIvEs')
True
>>> isalternate('pArAnEpHrItIs')
True