28
2
Input
A string that contains at most one of each of the letters A
, B
, and C
. They may be in any order. The empty string is valid input.
Note: A previous version of this challenge used the letters LEJ
instead of ABC
and they may still be used if desired.
Output
A string of the A
, B
, C
letters that were not present in the input. They may be in any order.
If the output would be the empty string then simply giving no output is valid, if that makes sense for your implementation. (e.g. you don't need to actually call print
on an empty string.)
Examples
- If the input is
B
then the output should either beCA
orAC
sinceA
andC
are not present in the input. - If the input is the empty string then the output should be
ABC
or any permutation since none of the three letters are present in the input. - If the input is
CAB
then the output should be the empty string because all three letters are present in the input.
Test Cases
There are so few input cases that we can enumerate all of them:
in -> out1 | out2 | out3 | ...
ABC -> ""
ACB -> ""
BCA -> ""
BAC -> ""
CAB -> ""
CBA -> ""
AB -> C
AC -> B
BC -> A
BA -> C
CA -> B
CB -> A
A -> BC | CB
B -> CA | AC
C -> AB | BA
"" -> ABC | ACB | BCA | BAC | CAB | CBA
All valid outputs for each input are given, separated by |
's. ""
represents the empty string
Scoring
The shortest code in bytes wins. But keep in mind that you may get more recognition for solving the challenge in a unique way rather than in a short way ;)
Is a list of characters acceptable for output, or must it be a string? – Mego – 2017-02-16T07:59:17.683
@Mego It must be a string (or be displayed as a string by default). – Calvin's Hobbies – 2017-02-16T08:01:02.387
1Cumbersome I/O format – Mego – 2017-02-16T08:02:12.633
@Mego It doesn't seem that cumbersome considering the difficulty of the task and shortness of the string. – Calvin's Hobbies – 2017-02-16T08:08:40.620
1The task is set difference between a constant and an input. Requiring that everything be done in strings is cumbersome with regards to the difficulty of the actual task. – Mego – 2017-02-16T08:09:38.903
In fact, since the challenge is really just set difference between a constant and an input, it's a dupe of this challenge.
– Mego – 2017-02-16T08:14:38.4672I vaguely remember a more exact dupe match where you had to subtract the input from a constant set. – xnor – 2017-02-16T08:26:25.037
@xnor That's the best one I could find. If you find a better dupe target, feel free to change it. – Mego – 2017-02-16T08:37:57.540
@xnor Any chance you're thinking of Helka's recent challenge?
– Martin Ender – 2017-02-16T10:13:12.503@MartinEnder No, I remember it as being from a while ago. – xnor – 2017-02-16T10:14:28.833
1Can inputs contain letters outside of "ABC"? The specification: "A string that contains at most one of each of the letters A, B, and C" does not exclude such inputs. – theonlygusti – 2017-02-16T13:56:18.530
Related – Adnan – 2017-02-16T13:58:58.837
Do you have to output all combinations or were you just showing all possible outputs separated by "|" ? – Albert Renshaw – 2017-02-16T17:29:06.787
1@theonlygusti The input should only contain ABC – Calvin's Hobbies – 2017-02-16T22:09:35.043
@AlbertRenshaw "All valid outputs for each input are given, separated by |'s." – Calvin's Hobbies – 2017-02-16T22:09:53.520
Related – Destructible Lemon – 2017-02-24T08:31:41.137