Question:Comparing values, help please

Question:Comparing values, help please

Maple

Codewords:=proc(L,x,y,z)
local
List:=[];

if L=S then
if x=1 then

print(`A 1 j k`);
else
print(`A 0 j k`);
fi:

if y=1 then

print(`B i 1 k`);
else

print(`B i 0 k`);
fi:
if z=1 then
print(`C i j 1`);
else

print(`C i j 0`);
fi:
fi:
if L=A then
if x=1 then

print(`S 1 j k`);
else

print(`S 0 j k`);
fi:

if y=1 then

print(`C i 1 k`);
else

print(`C i 0 k`);
fi:
if z=1 then
print(`B i j 1`);
else

print(`B i j 0`);
fi:
fi:

if L=B then
if x=1 then

print(`C 1 j k`);
else

print(`C 0 j k`);
fi:

if y=1 then

print(`S i 1 k`);
else

print(`S i 0 k`);
fi:
if z=1 then
print(`A i j 1`);
else

print(`A i j 0`);
fi:
fi:
if L=C then
if x=1 then

print(`B 1 j k`);
else

print(`B 0 j k`);
fi:

if y=1 then

print(`A i 1 k`);
else

print(`A i 0 k`);
fi:
if z=1 then
print(`S i j 1`);
else

print(`S i j 0`);
fi:
fi:

end proc:

Codewords(S,1,0,0);
Codewords(A,1,0,0);
Codewords(B,1,1,0);
A 1 j k
B i 0 k
C i j 0
S 1 j k
C i 0 k
B i j 0
C 1 j k
S i 1 k
A i j 0

So what i have done is to create a simple procedure that compares values 0 and 1 in a selection of 4 letters S,A,B,C.

This works fine but what i want to know is how to compare each of the above results. e.g. A values are A 1 j k, A i j 0. I want to write something that merges these into the form A 1 j 0, and also if you have two different values in same place then this couldnt work and you wouldnt display the value.

Any help would be great!

﻿