Official

A - 錬金術の材料 / Alchemy Materials Editorial by harurun4635 Editorial for printing


それぞれの出現回数が分かればよいです。工夫として index を用いるなどの方法があるかもしれません。


実装例

input()
print(sum(" CSG".index(x) for x in input()))

posted:
last update: