Logo
(追記) (追記ここまで)

32904번 - Ordinal Number 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB66564182.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.

  • Zero corresponds to an empty set: $f(0) = ${}.
  • One corresponds to the set containing the set $f (0)$ as an element: $f(1) = ${$f(0)$}$ = ${{}}.
  • Two corresponds to the set containing the sets $f (0)$ and $f (1)$ as elements: $f(2) = ${$f(0), f(1)$}$ = ${{},{{}}}.
  • And so on: each positive integer $k$ corresponds to the set containing all the previous ordinal numbers as elements. The formula is: $f(k) = ${$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.

제한

예제 입력 1

{}

예제 출력 1

0

예제 입력 2

{{}}

예제 출력 2

1

예제 입력 3

{{},{{}}}

예제 출력 3

2

예제 입력 4

{{{}},{{{}},{}},{}}

예제 출력 4

3

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2024-2025 Northwestern Russia Qualification C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /