/
実行時間制限: 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=
algorithmisa, so C_1=2. - The first character of S_2=
heuristicish, so C_2=4.
Thus, output 24, which is their concatenation.
Sample Input 2
3 i love you
Sample Output 2
459