<?php
$arr = array("A","B","C");
for ($i = 0; $i < count($arr); $i++) { echo $arr[$i]."\n";
for ($j = 0; $j < count($arr); $j++) { if ($i != $j) {
echo $arr[$i].$arr[$j]."\n";
for ($k = 0; $k < count($arr); $k++) { if ($i != $j && $i != $k && $j != $k) {
echo $arr[$i].$arr[$j].$arr[$k]."\n";
}
}
}
}
}
?>
PD9waHAKICAgICRhcnIgPSBhcnJheSgiQSIsIkIiLCJDIik7CiAgICAKICAgIGZvciAoJGkgPSAwOyAkaSA8IGNvdW50KCRhcnIpOyAkaSsrKSB7CiAgICAJZWNobyAkYXJyWyRpXS4iXG4iOwogICAgCWZvciAoJGogPSAwOyAkaiA8IGNvdW50KCRhcnIpOyAkaisrKSB7CiAgICAJCWlmICgkaSAhPSAkaikgewogICAgCQkJZWNobyAkYXJyWyRpXS4kYXJyWyRqXS4iXG4iOwogICAgCQkJZm9yICgkayA9IDA7ICRrIDwgY291bnQoJGFycik7ICRrKyspIHsKICAgIAkJCQlpZiAoJGkgIT0gJGogJiYgJGkgIT0gJGsgJiYgJGogIT0gJGspIHsKICAgIAkJCQkJZWNobyAkYXJyWyRpXS4kYXJyWyRqXS4kYXJyWyRrXS4iXG4iOwogICAgCQkJCX0KICAgIAkJCX0KICAgIAkJfQogICAgCX0KICAgIH0KICAgIAo/Pg==