| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 66 | 56 | 41 | 82.000% |
Ordinal numbers are an extension of the set of nonnegative integers. For each nonnegative integer $x,ドル we will establish the corresponding ordinal number $f (x)$. The first few ordinal numbers can be defined as follows.
{}.{$f(0)$}$ = ${{}}.{$f(0), f(1)$}$ = ${{},{{}}}.{$f(0), f(1), \ldots , f(k - 1)$}.Next, we can similarly define ordinal numbers that don't correspond to integers. Alas, we won't need them in this problem.
You are given a string describing an ordinal number corresponding to a nonnegative integer $n$. Find $n$.
The first line contains the description of an ordinal number corresponding to a certain nonnegative integer $n$ (0ドル \le n \le 15$). It consists of the characters "{", ",", and "}".
In the description of each set, each element appears exactly once. However, as a set does not change if we change the order of elements, this order can be arbitrary.
Print the integer $n$ corresponding to the given ordinal number.
{}
0
{{}}
1
{{},{{}}}
2
{{{}},{{{}},{}},{}}
3