#P2004. ACSL 2015-2016 Intermediate Division Contest #1 ACSL CHMOD
ACSL 2015-2016 Intermediate Division Contest #1 ACSL CHMOD
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 3 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. 526). When each
digit of that number is converted to binary, the binary digits are paired to represent read, write
and execute in that order. 526 would convert to 101 010 110.
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 526 = 101 010 110 = r-x -w- rw-
INPUT FORMAT
There will be 5 lines of input. Lines 1 and 2 will each contain 3 octal digits. Lines 3 and 4 will each contain three 3-digit binary numbers. Line 5 will contain three 3-character stings.
OUTPUT FORMAT
For each line of input print the other two equivalent forms of the CHMOD result. Print a space between each grouping as shown below.
SAMPLE
INPUT
5, 2, 6
7, 3, 0
100, 001, 101
010, 011, 100
r-x, rw-, rwx
OUTPUT
101 010 110 and r-x -w- rw-
111 011 000 and rwx -wx ---
415 and r-- --x r-x
234 and -w- -wx r--
567 and 101 110 111