Under construction

Still being built. Things may change

Octal

Interview

Time limit1sMemory limit128 MB

Summary
Convert a binary string (up to 100 digits) to octal by padding and grouping bits in threes using the given table.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

A positive integer is written in binary. Convert it to octal by using the following method.

  1. Add 0 characters to the front until the length of the binary string is a multiple of 3.
  2. Split the string into groups of three digits from left to right.
  3. Replace each three-digit binary group with one octal digit according to the table below.

Given the binary number, print its octal representation.

BinaryOctal
0000
0011
0102
0113
1004
1015
1106
1117

Input

The first line contains a binary number. Its length is between 1 and 100, inclusive, and its first character is 1.

Output

Print the converted octal number on one line.

Examples2

  1. Example 1

    Input
    1010
    
    Expected output
    12
    
  2. Example 2

    Input
    11001100
    
    Expected output
    314