Problem Q: Spinids


Source: spinids.{c,cpp,java}
Input: console {stdin,cin,System.in}
Output: console {stdout,cout,System.out}

Score words according to how similar they look when given a 180-degree spin.

Spinning the shape of lowercase letters 180 degrees can transform them into other characters or into themselves. Such symmetric characters can be used in words, which when spinned, form the same word, such as mow and pod. In a spinids game, words are scored with respect to how symmetric they are when given a 180-degree spin.

The letters that are spin-symmetric with themselves are l, o, and x. The letters that are spin-symmetric with some other letter are b vs. q, d vs. p, m vs. w, and n vs. u.

The score s(c1,c2) of two letters c1 and c2 is 3 if the two letters are the same and spin symmetric, 2 if the letters are different and spin-symmetric, 1 if the letters are the same but not spin-symmetric, and 0 if the letters are not the same and not spin-symmetric.

The score for a n-letter word w is the sum of the scores of the letter pairs:

s(w) = s(w1,wn)+s(w2,wn-1)+...+s(wn,w1).

Input

A list of lowercase alphabetic words, one per line.

Output

For every word in the input, the word and spinids-score of each word in the input, separated by a single blank space, one per line.

Sample input

spinids
xoxox
deep 
mow
pod
sis
un

Sample Output

spinids 9
xoxox 15
deep 6
mow 7
pod 7
sis 3
un 4