시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1190 679 631 60.966%

문제

창영이는 여러가지 진법을 공부하고 있다. 창영이는 어제 2진법을 배웠고, 오늘은 8진법을 배웠다. 이제, 2진법 수를 8진법 수로 변환하려고 한다.

창영이가 사용한 방법은 다음과 같다.

  1. 2진수의 길이가 3으로 나누어 떨어질 때 까지 수의 앞에 0을 붙인다.
  2. 그 다음, 3자리씩 그룹을 나눈다.
  3. 아래의 표를 참고해 8진수로 바꾼다.

2진수가 주어졌을 때, 창영이가 사용한 방법을 이용해 8진수로 바꾸는 프로그램을 작성하시오.

000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

입력

첫째 줄에 2진수가 주어진다. 이 수는 100자리 이내이고, 첫 번째 자리는 1이다.

출력

첫재 줄에 8진수를 출력한다.

예제 입력 1

1010

예제 출력 1

12

힌트

W3sicHJvYmxlbV9pZCI6IjI5OTgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiI4XHVjOWM0XHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgXHVjNWVjXHViN2VjXHVhYzAwXHVjOWMwIFx1YzljNFx1YmM5NVx1Yzc0NCBcdWFjZjVcdWJkODBcdWQ1NThcdWFjZTAgXHVjNzg4XHViMmU0LiBcdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgXHVjNWI0XHVjODFjIDJcdWM5YzRcdWJjOTVcdWM3NDQgXHViYzMwXHVjNmUwXHVhY2UwLCBcdWM2MjRcdWIyOThcdWM3NDAgOFx1YzljNFx1YmM5NVx1Yzc0NCBcdWJjMzBcdWM2ZTBcdWIyZTQuIFx1Yzc3NFx1YzgxYywgMlx1YzljNFx1YmM5NSBcdWMyMThcdWI5N2MgOFx1YzljNFx1YmM5NSBcdWMyMThcdWI4NWMgXHViY2MwXHVkNjU4XHVkNTU4XHViODI0XHVhY2UwIFx1ZDU1Y1x1YjJlNC48X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