← 返回 anthropic 的题目列表Token Usage Calculation
类型:online_judge
Given a block of text, calculate the total number of tokens consumed, assuming one token is approximately composed of 4 characters. No complex text processing is required; just perform a simple count. The code should handle multiple lines of input and return an integer representing the total token count.
Input
A block of text, potentially spanning multiple lines.
Output
An integer representing the total token count.
Example
Input:
This is a sample text.
It contains some characters.
Output: 7
Example
Input
This is a sample text.
It contains some characters.