RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00393

Nizovi

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(7^{th}\) round, March \(5^{th}\) 2016
An array in a certain programming language is defined in the following way:
• The beginning and the end of an array is denoted by an open and closed curly bracket, respec-
tively.
• Inside the curly braces, there are (possibly even 0) values separated by a comma (there is no
comma after the last value in the array).
• Each value can be a word (an array of lowercase letters of the English alphabet) or another
array.
• Examples of correctly defined arrays are: {}, {a,b,c}, {abc,znj,{novi,niz},pozz}.
Recently, you’ve noticed that the programming language does not throw an error if you do not place
the appropriate number of spaces and new lines before or after the curly braces or the commas. Given
the fact that you too mind the values being so „squished“ together, you’ve decided to get to work and
modify the shape of the array in the following way:
• Each value that is not an array or denotes the beginning or the end of the array (curly braces)
will be in its own line.
• The commas are „connected“ with the value located directly before them and there is a new line
after each comma.
• After the curly bracket denoting the beginning of the array, the indentation of the content
increases (shifting the output to the right) for 2 spaces.
• Before the curly bracket denoting the end of the array ’}’, the indentation of the content decre-
ases (shifting the output to the left) for 2 spaces.

제약

In test cases worth 50% of total points, all values in the array are going to be words (in other words,
it won’t be the case that a value is another array).

입력 형식

The first line of input contains an array of characters \(S\) (1 ⩽|\(S\)| ⩽1500), representing the array from
the task.

출력 형식

The output must consist of the modified version of the array from the task.

예제 1
입력
{abc,ono,sto}
출력
{
  abc,
  ono,
  sto
}
예제 2
입력
{}
출력
{
}
예제 3
입력
{znakovi}
출력
{
  znakovi
}
예제 4
입력
{a,b,{c,d},e,{}}
출력
{
  a,
  b,
  {
    c,
    d
  },
  e,
  {
  }
}
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 7

평가 및 의견

Nizovi

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Nizovi

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8