← 返回 google 的题目列表Collect Token
类型:online_judge
You have a single-player board game with N positions described by a string. Each position can be empty (denoted by '.'), contain a player's token (denoted by 'T'), or contain a coin (denoted by 'C'). The player may possess multiple tokens. A coin is collected by the player when a token is put on the coin's position (each coin can be collected only once). Given the board described by the string, calculate the number of coins that can be collected by the player.
Input:
A string of length N consisting of '.', 'T', and 'C', representing the board.
Output:
An integer representing the number of coins that can be collected.
Example
Input
T.C..TT.C