#P2000. ACSL 2015-2016 Junior Division Contest #1 ACSL CHMOD

ACSL 2015-2016 Junior Division Contest #1 ACSL CHMOD

PROBLEM DESCRIPTION

CHMOD is a command in the UNIX computer system. It is the command used for giving users permissions to access and change files and directories. There are 33 classes of users. They are the owner, the group and others. The permissions given are: read(r), write(w) and execute(x).

The argument of the CHMOD command is a 3-character octal number (ex. 526526). When each digit of that number is converted to binary, the binary digits are paired to represent read, write and execute in that order. 526526 would convert to 101101 010010 110110.

The first binary conversion gives the user permissions. The second gives the group permissions. The third gives the others permissions. So here, the owner has read and execute permissions and that is represented by r-x. The group has only write permission given by -w-. The others class has read and write permissions as shown by rw-.

Putting all of the above together CHMOD 526526 = 101101 010010 110110 == r-x -w- rw-

INPUT FORMAT

There will be 55 lines of input. Each line will contain 33 octal digits.

OUTPUT FORMAT

For each line of input, print the 99-bit binary conversion (in order from left to right with a space between each conversion) and the 99-character permission string (in order from left to right with a space between each conversion). Both outputs must be correct to get the point.

SAMPLE

INPUT #1

5, 2, 6
7, 3, 0
4, 1, 5
2, 3, 4
5, 6, 7

OUTPUT #1

101 010 110 and r-x -w- rw-
111 011 000 and rwx -wx ---
100 001 101 and r-- --x r-x
010 011 100 and -w- -wx r--
101 110 111 and r-x rw- rwx