B - 459 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 200

問題文

英小文字のみからなる N 個の文字列 S_1,S_2,\ldots,S_N が与えられます。

N 個の数字 C_1,C_2,\ldots,C_N を以下のように定義します。

  • S_i の先頭の文字が a, b, c のいずれかならば C_i=2
  • S_i の先頭の文字が d, e, f のいずれかならば C_i=3
  • S_i の先頭の文字が g, h, i のいずれかならば C_i=4
  • S_i の先頭の文字が j, k, l のいずれかならば C_i=5
  • S_i の先頭の文字が m, n, o のいずれかならば C_i=6
  • S_i の先頭の文字が p, q, r, s のいずれかならば C_i=7
  • S_i の先頭の文字が t, u, v のいずれかならば C_i=8
  • S_i の先頭の文字が w, x, y, z のいずれかならば C_i=9

C_1,C_2,\ldots,C_N をこの順に連結した文字列を出力してください。

制約

  • 1\leq N\leq 10
  • N は整数
  • S_i は英小文字のみからなる長さ 1 以上 10 以下の文字列

入力

入力は以下の形式で標準入力から与えられる。

N
S_1 S_2 \ldots S_N

出力

C_1,C_2,\ldots,C_N をこの順に連結した文字列を出力せよ。


入力例 1

2
algorithm heuristic

出力例 1

24
  • S_1=algorithm の先頭の文字は a であるため、C_1=2 となります。
  • S_2=heuristic の先頭の文字は h であるため、C_2=4 となります。

よって、これらを連結した 24 を出力します。


入力例 2

3
i love you

出力例 2

459

Score : 200 points

Problem Statement

You are given N strings S_1, S_2, \ldots, S_N consisting of lowercase English letters.

Define N digits C_1, C_2, \ldots, C_N as follows:

  • If the first character of S_i is one of a, b, c, then C_i= 2
  • If the first character of S_i is one of d, e, f, then C_i= 3
  • If the first character of S_i is one of g, h, i, then C_i= 4
  • If the first character of S_i is one of j, k, l, then C_i= 5
  • If the first character of S_i is one of m, n, o, then C_i= 6
  • If the first character of S_i is one of p, q, r, s, then C_i= 7
  • If the first character of S_i is one of t, u, v, then C_i= 8
  • If the first character of S_i is one of w, x, y, z, then C_i= 9

Output the string obtained by concatenating C_1, C_2, \ldots, C_N in this order.

Constraints

  • 1 \leq N \leq 10
  • N is an integer.
  • S_i is a string of length between 1 and 10, inclusive, consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

N
S_1 S_2 \ldots S_N

Output

Output the string obtained by concatenating C_1, C_2, \ldots, C_N in this order.


Sample Input 1

2
algorithm heuristic

Sample Output 1

24
  • The first character of S_1= algorithm is a, so C_1= 2.
  • The first character of S_2= heuristic is h, so C_2= 4.

Thus, output 24, which is their concatenation.


Sample Input 2

3
i love you

Sample Output 2

459