/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
錬金術師の高橋君は N 個の材料を持っています。材料は長さ N の文字列 S で表され、 S の i 文字目は i 番目の材料の種類です。 G は金、 S は銀、 C は銅を表します。
材料の価値は、金が 1 個 3 点、銀が 1 個 2 点、銅が 1 個 1 点です。高橋君が持っている材料の価値の合計を求めてください。
制約
- 1 \leq N \leq 100
- S は
G、S、Cのみからなる長さ N の文字列
入力
入力は以下の形式で標準入力から与えられる。
N S
- 1 行目には、材料の個数 N が与えられる。
- 2 行目には、材料の種類を表す文字列 S が与えられる。
出力
材料の価値の合計を 1 行で出力せよ。
入力例 1
3 GSC
出力例 1
6
入力例 2
3 GGG
出力例 2
9
入力例 3
5 SSCCG
出力例 3
9
入力例 4
9 SSSGCCCCS
出力例 4
15
入力例 5
21 GSSGGGSGSGCGGCGCGCCSG
出力例 5
48
Score : 200 pts
Problem Statement
Takahashi, an alchemist, has N materials. The materials are represented by a string S of length N, where the i-th character of S is the type of the i-th material. G represents gold, S represents silver, and C represents copper.
The values of the materials are: 3 points for each gold, 2 points for each silver, and 1 point for each copper. Find the total value of the materials Takahashi has.
Constraints
- 1 \leq N \leq 100
- S is a string of length N consisting only of
G,S, andC.
Input
The input is given from Standard Input in the following format:
N S
- The first line contains the number of materials N.
- The second line contains the string S representing the types of the materials.
Output
Print the total value of the materials in one line.
Sample Input 1
3 GSC
Sample Output 1
6
Sample Input 2
3 GGG
Sample Output 2
9
Sample Input 3
5 SSCCG
Sample Output 3
9
Sample Input 4
9 SSSGCCCCS
Sample Output 4
15
Sample Input 5
21 GSSGGGSGSGCGGCGCGCCSG
Sample Output 5
48