# Question
Title: How many Wazirs can be placed on an N×N Chessboard?
Suppose a new fairy chess piece named the Wazir is introduced to chess. Wazirs can move from a position (*x*, *y*) to:
(*x*+1, *y*)
(*x*, *y*+1)
(*x*-1, *y*)
(*x*, *y*-1)

That is, they move orthogonally like the rook, but only one step at a time like the king. How many such wazirs can be placed on an N×N chessboard so that no two wazirs can attack each other?

On a 1×1 board, there can be only 1 such piece.
On a 2×2 board, there can be 2 such pieces.
On a 3×3 board, there can be 5 such pieces.

Given N, return the number of wazirs that can be placed on an N×N chessboard.

This is OEIS sequence A000982.

### More test cases

`7``25`

`8``32`

`100``5000`

# Answer
> 33 votes
# Whitespace, 45 bytes

```

```

Try it online!

By the way, here is a proof that the ⌈n²/2⌉ formula is correct.

* **We can always place at least ⌈n²/2⌉ wazirs**: just lay them out in a checkerboard pattern! Assuming the top-left tile is white, there are ⌈n²/2⌉ white tiles and ⌊n²/2⌋ black tiles on the *n × n* board. And if we place wazirs on the white tiles, no two of them are attacking each other, as every wazir only “sees” black tiles.

Here’s how we place 13 wazirs on a 5 × 5 board (each W is a wazir).
* **We can’t do any better**: let’s arbitrarily tile the checkerboard with 2 × 1 domino pieces, optionally using a 1 × 1 piece for the final corner of an odd-length chessboard, like so:

We need ⌈n²/2⌉ dominoes to cover the chessboard. Clearly, putting two wazirs on one domino makes it so that they can attack one another! So each domino can only contain at most one wazir, meaning we can’t *possibly* place more than ⌈n²/2⌉ wazirs on the board.

# Answer
> 16 votes
# Oasis, 3 bytes

```
k>v

```

Try it online!

square - increment - integer halve

# Answer
> 11 votes
# Prolog (SWI), ~~22~~ 19 bytes

Saved 3 bytes thanks to *Kevin Cruijssen*

```
X*Y:-Y is(X*X+1)/2.

```

Try it online!

# Answer
> 10 votes
# APL (Dyalog), ~~9~~ ~~7~~ 6 bytes

Now uses Mr. Xcoder's formula.

This is an anonymous prefix tacit function which takes N as argument.

```
⌈2÷⍨×⍨

```

Try it online!

`×⍨` square N (lit. multiplication selfie, i.e. multiply by self)

`2÷⍨` divide by 2

ceiling (round up)

# Answer
> 7 votes
# JS (ES6) / C# polyglot, 11 bytes

```
n=>n*n+1>>1

```

### Test cases

```
let f =

n=>n*n+1>>1

console.log(f(7))
console.log(f(8))
console.log(f(100))
```

# Answer
> 6 votes
# 05AB1E, 3 bytes

Straight implementation of the formula given by A000982

```
n;î

```

Try it online!

**Explanation**

```
n      # square
 ;     # divide by 2
  î    # round up

```

# Answer
> 6 votes
# dc, 6 bytes

```
2^2~+p

```

`2^`: square; `2~`: divide by 2, pushing the quotient then the remainder; `+p`: add the remainder to the quotient & print.

Try it online!

# Answer
> 5 votes
# C (gcc), ~~23~~ ~~18~~ 17 bytes

* Saved a byte thanks to Tahg; golfing `n/2+n%2` to `n+1>>1`.

```
f(n){n=n*n+1>>1;}

```

Try it online!

# C (gcc), 22 bytes (not using undefined behavior)

```
f(n){return n*n+1>>1;}

```

Try it online!

Some people really do not like exploiting a certain compiler's undefined bahavior when using specific compiler flags. Doing so does save bytes, though.

# Answer
> 5 votes
# Python 2, 17 bytes

1 byte thanks to @ovs.

```
lambda x:x*x+1>>1

```

Try it online!

# Answer
> 4 votes
# Python 3, 19 bytes

```
lambda x:-(-x*x//2)

```

Try it online!

```
lambda x:-(-x*x//2)  # Unnamed function
lambda x:            # Given input x:
            x*x      # Square
           -         # Negate
               //2   # Halve and Floor (equivalent of Ceil)
         -(       )  # Negate again (floor -> ceil)

```

-1 byte thanks to Mr. Xcoder

# Answer
> 4 votes
# Brachylog, 6 bytes

```
^₂/₂⌉₁

```

Try it online!

# Answer
> 4 votes
# x86\_64 machine language (Linux), ~~9~~ 8 bytes

```
0:       97                      xchg   %eax,%edi
1:       f7 e8                   imul   %eax
3:       ff c0                   inc    %eax
5:       d1 f8                   sar    %eax
7:       c3                      retq

```

To Try it online!, compile and run the following C program.

```
#include<stdio.h>
const char *f="\x97\xf7\xe8\xff\xc0\xd1\xf8\xc3";
int main() {
  for(int i=1; i<10; i++) {
    printf("%d\n", ((int(*)())f)(i));
  }
}

```

# Answer
> 3 votes
# , 8 bytes

Anonymous tacit prefix function.

```
2>.@%~*:

```

Try it online!

`*:` square

`>.` ceiling (round up)
`@` after
`2``%~` dividing by two

# Answer
> 3 votes
# , ~~22~~ 21 bytes

```
cat((scan()^2+1)%/%2)

```

Try it online!

Square, increment, integer divide. Easy peasy.

Input from stdin; it can take space or newline separated input and it will compute the max wazirs for each input boardsize. Output to stdout.

*-1 byte thanks to plannapus*

# Answer
> 3 votes
# Actually, 3 bytes

```
²½K

```

**Try it online!**

# Answer
> 3 votes
# Mathematica, 12 bytes

```
⌈#^2/2⌉&

```

# Answer
> 2 votes
# Pyth, 6 bytes

```
.E**.5

```

**Try it online!**

# Answer
> 2 votes
# Pyke, 3 bytes

```
Xhe

```

**Try it here!**

## How?

```
X   - Square.
 h  - Increment.
  e - Floor halve.

```

# Answer
> 2 votes
# C# (.NET Core), ~~14~~ 12 bytes

-2 bytes thanks to Emigna

```
n=>(n*n+1)/2

```

Try it online!

# Answer
> 2 votes
# Perl 5, 16 bytes

```
$_=0|$_*$_/2+.5

```

Try it online!

# Answer
> 2 votes
# MATL, 5 bytes

```
UH/Xk

```

Try it online!

# Answer
> 2 votes
# Cubix, 11 bytes

```
Iu*:^\)2,O@

```

Heheh, `:^\)`

Try it online!

Expands to the following cube:

```
    I u
    * :
^ \ ) 2 , O @ .
. . . . . . . .
    . .
    . .

```

Which is the same algorithm that many use.

* `^Iu` : read in input as int and change directions
* `:*` : dup top of stack, multiply
* `\)` : change direction, increment
* `2,` : push 2, integer divide
* `O@` : print output as int, end program.

# Answer
> 2 votes
# Pyke, 3 bytes

```
Xhe

```

Try it here!

```
X   -   input ** 2
 h  -  ^ + 1
  e - floor_half(^)

```

# Answer
> 2 votes
# Ohm v2, 3 bytes

```
²½ı

```

Try it online!

`²` squares, `½` halves, `ı` ceils.

# Answer
> 1 votes
# Jelly, 3 bytes

-1 thanks to Mr. Xcoder.

Based on my APL solution.

```
²HĊ

```

Try it online!

`²` Square

`H`**H**alve

`Ċ`**C**eiling (round up)

# Answer
> 1 votes
# Japt, 4 bytes

Been sitting on these since the challenge was closed.

```
²Ä z

```

Try it

**Explanation:** Square, add 1, floor divide by 2

---

## Alternative

```
²ÄÁ1

```

Try it

**Explanation:** Square, add 1, bit-shift right by 1.

# Answer
> 1 votes
# Cubically, 12 bytes

```
$:*FDF'+8/0%

```

Try it online!

Personally I don't see any point with using language features newer than the challenge to get less bytes, because you mostly compete with yourself (almost always there are at most one answer/language/challenge), but I still updated, by MDXF's suggestion. `:` defaults to `:7` is a good idea anyway.

---

Explanation:

```
$:*7FDF'+8/0%
$                  Read input as number.
 :                 Set notepad value (face 6) to input.
  *                Multiply notepad value with itself.
   FDF'            Scramble the cube so face 8 value will be 1
                   (unsolved) and face 0 value will be 2.
       +8          Add 1 (face 8 value) to notepad value.
         /0        Divide notepad value by 2 (face 0 value),
                   get integer part.
           %       Output notepad value as number.

```

This program works because `ceil(n^2 / 2) == floor((n^2 + 1) / 2)`.

# Answer
> 1 votes
# ,,,, 7 bytes

```
2*1+1»

```

Try it online!

Yay, commata works for something!

Fudge, I didn't implement ceiling...

# Answer
> 1 votes
# Gaia, 3 bytes

```
sḥ⌉

```

Try it online!

`s` squares,  halves,  ceils.

# Answer
> 1 votes
# Commentator, 19 bytes

```
//{-//-}! {-#  -}<!

```

Try it online!

Who needs golfing languages? I've got confusing languages!

Ungolfed version:

```
5//{-8}//{5-}
print(10!= 5)
x={-1,3,4} # Smiley :-}
print(5<!=10)*/ # Weird comparision.

```

Try it online!

How does it work? I'll explain, with input 5

```
//                         - Take input.                           Tape: [5 0 0]
  {-//-}!                  - Square the input.                     Tape: [25 0 0]
  {-                         - Move one along the tape
    //                       - Copy the input to the tape.         Tape: [5 5 0]
      -}                     - Move one back along the tape
        !                    - Take the product of the tape.       Tape: [25 5 0]
         <space>           - Increment the tape head.              Tape: [26 5 0]
                 {-#  -}<! - Halve the tape head (floor division). Tape: [13 2 0]
                 {-          - Move one along the tape
                   #         - Set the tape head to 2.             Tape: [26 2 0]
                      -}     - Move one back along the tape
                        <!   - Reduce the tape by floor division.  Tape: [13 2 0]

```

# Answer
> 1 votes
# OCaml, 19 bytes

```
let f n=(n*n+1)/2;;

```

Try it online!

I'm a bit bummed the name got changed from "camels" to "wazirs" before I managed to write this, but I figured I'd post it anyway.

# Answer
> 1 votes
# TI-Basic, 7 bytes

```
round(Ans²/2,0

```

Alternatively (8 bytes):

```
int(Ans²/2+.5

```

# Answer
> 1 votes
# ///, 35 bytes

```
/I///,*/+,//+/I//**,/,A//*/A//,//,I

```

Try it online!

Takes input in unary using symbol `*`, and output in unary using symbol `A`. This is allowed for some specific languages, including /// (meta)

Because there is no way to take input in ///, input should be hardcoded:

```
/I/«put input here»//,*/+,//+/I//**,/,A//*/A//,//,I

```

for input = 4.

---

Explanation: (before reading, you need to know that the only syntax of `///` are `/pattern/replacement/`, which replace every occurence of `pattern` by `replacement`; and `\` for escaping; other characters is printed to output)

For `n=4`:

```
/I/****//,*/+,//+/I//**,/,A//*/A//,//,I    Start program.
/I/****/                                   Replace all `I` in the program by the input.

/,*/+,//+/****//**,/,A//*/A//,//,****      Remaining part of the program.
/,*/+,/                                    Use the `,` as a scanner, scan through `*` after it and convert to `+`.
       /+/****//**,/,A//*/A//,//++++,      Note that only `*` in the second group is affected.
       /+/****/                            Replace all `+` (which is just created) by `n` asterisks (from the first `I` group)

/**,/,A//*/A//,//****************,         Now at the last of the program before the `,` there are `n²` asterisks.
/**,/,A/                                   Scan the `,` to the left to perform division by 2:
                                           replace each `**` by a `A` as the scanner `,` pass through.
/*/A//,//,AAAAAAAA                         Remaining program.
/*/A/                                      If there is any `*` remaining (if `n²` is odd), replace it with `A`.
     /,//                                  Remove the scanner `,`.
          AAAAAAAA                         Output the result.

```

# Answer
> 0 votes
# Husk, 3 bytes

```
⌈½□

```

Try it online!

The code is pretty much self-explanatory:

* Square.
* `½` Halve.
* Ceil.

# Answer
> 0 votes
# Java 8, ~~20~~ 11 bytes

```
i->i*i+1>>1

```

# Answer
> 0 votes
# Convex, 5 bytes

```
{²½¯}

```

Try it online!

This is the same as CJam's `{2#2./m]}`.

# Answer
> 0 votes
# Neim, 3 bytes

```
ᛦ>ᚺ

```

Try it online!

# Answer
> 0 votes
# RProgN 2, 6 bytes

```
2^1+2÷

```

Try it online!

# Answer
> 0 votes
## PocoLithp, 21 bytes

```
(#(N)(/(+(* N N)1)2))

```

Anonymous lambda taking argument `N`. Can be used in either of the following ways:

* `((#(N)(/(+(* N N)1)2))7)` \- call with argument `7`
* `(begin
 (define camel (#(N)(/(+(* N N)1)2)))
 (camel 7))`

Enter either of these lines into the REPL to test.

This language was created a few weeks ago, and the most recent changes a day ago are just bug fixes.

# Answer
> 0 votes
# ARBLE, 11 bytes

```
ceil(n^2/2)

```

Try it online!

# Answer
> 0 votes
# Bash, 18 bytes

```
echo $[$1*$1+1>>1]

```

Try it online

# Answer
> 0 votes
# Add++, 13 bytes

```
+?
^2
+1
/2
O

```

Try it online!

Looks like I got here too late (again)

# Answer
> 0 votes
# ASP, 13 bytes

```
a((x*x+1)/2).

```

Call with `clingo -c x=7` or by putting `#const x=7.` in source.

# Answer
> 0 votes
# Haskell, 18 bytes

`w n=ceiling(n*n/2)`

Run as:

`main = print $ w n`

Where `n` is the input number.

# Answer
> 0 votes
# FALSE, 6 bytes

`$*1+2/`

Explanation:

* `$` duplicate top of stack
* `*` multiply
* `1` push 1
* `+` add
* `2` push 2
* `/` divide

False only has 32-bit integers.

# Answer
> 0 votes
# x86 machine code, 6 bytes

Takes its argument in `eax` register, returns also there.

```
f7 e0   mul eax
40      inc eax
d1 e8   shr eax,1
c3      ret

```

# Answer
> 0 votes
# JavaScript (ES8), 16 bytes

```
x=>(h=x*x/2)+h%1
x=>                  // arrow function
   (h=x*x/2)         // dictionarying
            +h%1     // Math.ceil function

```

# Answer
> 0 votes
# Excel, 15 bytes

```
=ROUND(A1^2/2,)

```

Because we are dividing by 2, we can safely replace `CEILING` with `ROUND`, saving 3 bytes.

```
=CEILING(A1^2/2,1)

```

# Answer
> 0 votes
# MMIX, 16 bytes (4 instrs)

xxd, jelly code page

```
00000000: 1800 0000 2100 0001 3f00 0001 f801 0000  ð¡¡¡!¡¡¢?¡¡¢ẏ¢¡¡

```

disassembly

```
waz MUL $0,$0,$0
    ADD $0,$0,1
    SRU $0,$0,1
    POP 1,0

```

Uses the obvious trick of getting \\$\lceil{n^2\over2}\rceil\\$ by adding one and rounding down.

# Answer
> 0 votes
# BRASCA, 8 bytes

```
igC2^}2/

```

## Explanation

```
ig        - Turn charcodes into numbers, and concatenate input.
  C       - Set implicit output to output numbers
   2^     - (n**2
     }    -      +1)
      2/  -         /2
          - NOTE: BRASCA only handles whole integers, and will automatically Math.floor().
          - Implicitly output

```

Try it online!

# Answer
> 0 votes
# Thunno 2, 3 bytes

```
²½ṃ

```

Try it online!

Same as all the other answers:

* `²` = square
* `½` = halve
* = ceil

---
Tags: code-golf, number, chess
---


title: As Easy As A-B-C

text:
# Question
Title: As Easy As A-B-C
# 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 be `CA` or `AC` since `A` and `C` 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 ;)

# Answer
# Python 3, ~~29~~ ~~27~~ 22 bytes

```
lambda x:{*"ABC"}-{*x}

```

-2 bytes thanks to Jonathan Allan

-5 bytes thanks to Rod
> 20 votes

# Answer
# Jelly, 4 bytes

Thanks to @DuctrTape for the prod about the change and the presence of "ABC" in Jelly's dictionary.

```
“ḃ»ḟ

```

**Try it online!**

`“ḃ»` looks up the entry "ABC" in Jelly's dictionary,  is the filer discard dyad which discards the characters found in the input from that list of characters. The result is implicitly printed.

---

For a lower case version the dictionary entry to use can be either of "abac" (`“c»`) or "abaca" (`“i»`).

---

When the challenge was "LEJ" only **6** bytes could be achieved in the upper case variant, since no dictionary entries exist with that set of characters, leaving us to create the list of characters `“LEJ”` (or a permutation thereof).

The lowercase variant faired better at **5** bytes due to the presence of the word "jell" (`“ẎṄ»`).
> 10 votes

# Answer
# 05AB1E, ~~6~~ 4 bytes

Saved 2 bytes using the new `žR` command as suggested by *Kevin Cruijssen*

```
žRsм

```

Try it online! or as a Test Suite

**Explanation**

```
   м  # remove the character of
  s   # the input
žR    # from the string "ABC"

```
> 6 votes

# Answer
# Bash \+ coreutils, 15 bytes

```
tr -d x$1<<<LEJ

```

Try it online!

I'd like to omit the `x`, but then `tr -d` would be missing an argument when the input string was empty. (The `x` doesn't do any harm, since there aren't any x's in the here-string LEJ.) I'd normally write `tr -d "$1"`, but doing it the way I did is one byte shorter than that.
> 6 votes

# Answer
# Retina, 14 bytes

Byte count assumes ISO 8859-1 encoding.

```
$
¶ABC
D`.
A1`

```

Try it online!

### Explanation

```
$
¶ABC

```

Append a second line containing `ABC`.

```
D`.

```

Deduplicate the characters. This deletes every character from the second line which already appears in the first line.

```
A1`

```

Discard the first line.
> 6 votes

# Answer
# Java 7, ~~73~~ 58 bytes

```
String c(String s){return"EJL".replaceAll("[ "+s+"]","");}

```

15 bytes saved thanks to *@KritixiLithos*.

**Test code:**

Try it here.

```
class M{
  static String c(String s){return"EJL".replaceAll("[ "+s+"]","");}

  public static void main(final String[] a) {
    System.out.print("LEJ=" + c("LEJ") + "; ");
    System.out.print("LJE=" + c("LJE") + "; ");
    System.out.print("EJL=" + c("EJL") + "; ");
    System.out.print("ELJ=" + c("ELJ") + "; ");
    System.out.print("JLE=" + c("JLE") + "; ");
    System.out.print("JEL=" + c("JEL") + "; ");
    System.out.print("LE=" + c("LE") + "; ");
    System.out.print("LJ=" + c("LJ") + "; ");
    System.out.print("EJ=" + c("EJ") + "; ");
    System.out.print("EL=" + c("EL") + "; ");
    System.out.print("JL=" + c("JL") + "; ");
    System.out.print("JE=" + c("JE") + "; ");
    System.out.print("L=" + c("L") + "; ");
    System.out.print("E=" + c("E") + "; ");
    System.out.print("J=" + c("J") + "; ");
    System.out.print("\"\"=" + c(""));
  }
}

```

**Output:**

```
LEJ=; LJE=; EJL=; ELJ=; JLE=; JEL=; LE=J; LJ=E; EJ=L; EL=J; JL=E; JE=L; L=EJ; E=JL; J=EL; ""=EJL

```
> 5 votes

# Answer
# Actually, 7 bytes

```
"LEJ"-Σ

```

Try it online!

```
"LEJ"-Σ
"LEJ"    the letters
     -   exclude letters present in input
      Σ  concatenate

```
> 5 votes

# Answer
# Pyth, 5 bytes

```
-"ABC

```

Test it here

Expands to

```
-"ABC"Q
-       # Filter on absence
 "ABC"  # Literal string
      Q # Input

```
> 5 votes

# Answer
# JavaScript ES6, 41 39 38 Bytes

```
s=>eval(`'ABC'.replace(/[${s}]/g,'')`)

```

Saved 2 bytes thanks to Arnauld. Saved 1 bytes thanks to LarsW.

```
f=s=>eval(`'ABC'.replace(/[${s}]/g,'')`)

console.log(f("AB"));
```
> 4 votes

# Answer
# MATL, ~~10~~ 8 bytes

Saved two bytes thanks to Suever. `setdiff` is shorter than `ismember`.

```
'ABC'iX-

```

**Try it here!**

**Explanation**

```
'ABC'      % Create a string literal
     i     % User input
      X-   % Set difference, between two elements of the stack

```

Yes, this might have been a trivial task, but I'm quite satisfied I managed to solve it with MATL all by myself. I never said it was the shortest solution... Thanks Suever!
> 4 votes

# Answer
# , 10 bytes

```
CLEJ<ESC>Ó[<C-r>"]

```

Try it online!

Hexdump:

```
00000000: 434c 454a 1bd3 5b12 225d                 CLEJ..[."]

```

### Explanation

Input is on the first line of the buffer. So something like:

```
EL

```

and the cursor is on the first character. So we delete the input (which stores it in register `"`) and enter insert mode simultaneously using `C`.

Once in insert mode, the characters `LEJ` are inserted, after which I return to normal mode using `<ESC>`.

Now we have to remove all the characters that are present in the input.

```
Ó                       " remove every
 [<C-r>"]               "  character that appears in the input
                        " synonym of Vim's :s/[<C-r>"]//g

```

And once this happens, we are left with the remaining letters in the buffer.
> 3 votes

# Answer
## Ruby, ~~27 19~~ 18 bytes

```
->s{"ABC".tr s,""}

```

-1 byte thanks to Martin Ender
> 3 votes

# Answer
# Haskell, ~~27~~ 26 bytes

```
import Data.List
("ABC"\\)

```

Try it online! Usage: `("ABC"\\) "CB"` yields `"A"`.

`\\` is the set difference operator, the parenthesis form a so called *section* which is a short form for the lamda `(\x -> "ABC" \\ x)`.

---

**Without import:** (same byte count thanks to @nimi)

```
f x=[c|c<-"ABC",all(/=c)x]

```

Try it online! Usage: `f "CB"` yields `"A"`.

---

Other approaches:

```
f x=filter(`notElem`x)"ABC"
(`filter`"ABC").flip notElem
f x=[c|c<-"ABC",notElem c x]

```
> 3 votes

# Answer
# Brain-Flak, 120 + 3 = 123 bytes

```
<>((((((((()()){}){}){}){}){}())())())<>{({}(<()>)){(([({})]<>({}))){(<({}<>{})<>([{}]{}<>)>)}{}}{}{}<>{}{({}<>)<>}{}}<>

```

It is run with the `-c` flag, adding 3 bytes

Try it online!

## Explanation

Overall this program pretty much does the right stack set minus the left stack with the right stack initialized to `CBA` and the left stack initialized to the input.

### Annotated Code

```
<>((((((((()()){}){}){}){}){}())())())<> # Switch to right stack, push CBA, switch back
{({}(<()>)){(([({})]<>({}))){(<({}<>{})<>([{}]{}<>)>)}{}}{}{}<>{}{({}<>)<>}{}}<>

```

*More explanation to come...*
> 3 votes

# Answer
# GNU sed, ~~34~~ 29 bytes

Includes +1 for `-r`

-5 thanks to Digital Trauma

```
s/^/ABC/
:
s/(.)(.*)\1/\2/
t

```

Try it online!

For some reason TIO doesn't work with extended regex (`-r`), so I had to wrap it in BASH.

---

```
s/^/ABC/        # put ABC at the beginning of the string
:               # nameless label
s/(.)(.*)\1/\2/ # remove a duplicate letter
t               # branch to the nameless label if something changed

```
> 3 votes

# Answer
## Mathematica, 37 bytes

```
Complement@@Characters@{"ABC",#}<>""&

```
> 2 votes

# Answer
# Octave, ~~29~~ 27 bytes

Saved two bytes thanks to Suever, by creating the string `'ABC'`, inside the `ismember` call.

```
@(s)x(~ismember(x='ABC',s))

```

We use `~ismember()` as logical indices to the variable `x`. The peculiar thing is, we create `x='ABC'` *inside* `ismember`, not in front of it. The order Octave sees this:

```
@(s)                        % Anonymous function that takes a string s as input
                x='ABC'     % Create a variable x with the characters 'ABC'
       ismember(x='ABC',s)  % True for elements that are in both x and s. False otherwise.
      ~ismember(x='ABC',s)  % Negate this, so that we keep the characters that aren't in s
@(s)x(~ismember(x='ABC',s)) % Use the logical vector as indices to x and return the result

```
> 2 votes

# Answer
# Carrot, 15 bytes

*I found a bug with returning matches and empty strings. So I just fixed it*

```
ABC^//[^#]/gS""

```

Try it online! (copy & paste)

### Explanation

```
ABC^                   //sets stack (just a string, not an array) to "ABC"
    /                  //return match(es) of:
     /[^#]/g           // `#` is the placeholder for the input
                       // so effectively, this returns the matches of any character not present in the input
                       // applied on the stack
                       //this returns an array of all the matches of the regex
            S""        //join all the elements of the array using "", the empty string

```
> 2 votes

# Answer
## CJam, 7 bytes

```
"ABC"l-

```

Try it online! (As a linefeed-separated test suite.)
> 2 votes

# Answer
# MATLAB / Octave, 20 bytes

```
@(x)setdiff('ABC',x)

```

Online Demo
> 2 votes

# Answer
# C#, 50 Bytes 32 Bytes 47 Bytes 35 Bytes

where `i` is the input:

```
i=>string.Join("","ABC".Except(i));

```

**Full app tested in LINQPad**

```
void Main()
{
    var testcases = new Dictionary<string,string[]>
    {
        ["ABC"] = new[]{""},
        ["ACB"] = new[]{""},
        ["BCA"]  = new[]{""},
        ["BAC"]  = new[]{""},
        ["CAB"]  = new[]{""},
        ["CBA"]  = new[]{""},
        ["AB"] = new[]{"C"},
        ["AC"] = new[]{"B"},
        ["BC"] = new[]{"A"},
        ["BA"] = new[]{"C"},
        ["CA"] = new[]{"B"},
        ["CB"] = new[]{"A"},
        ["A"] = new[]{"BC","CB"},
        ["B"] = new[]{"CA","AC"},
        ["C"] = new[]{"AB","BA"},
        [""] = new[]{"ABC","ACB","BCA","BAC","CAB","CBA"},
    };

    var output = "";

    foreach(var input in testcases.Keys)
    {
        var expect = testcases[input];
        var actual = GetResult(input);
        if(!expect.Contains(actual)) throw new ApplicationException($"{input}:{string.Join(",",expect)}:{actual}");
        output+=$"{input} -> {actual}\n";
    }
    output.Dump();
}

// Define other methods and classes here
private string GetResult(string input){
    return string.Join("","ABC".Except(i));
}

```

**Test results**

> ABC -\>
> ACB -\>
> BCA -\>
> BAC -\>
> CAB -\>
> CBA -\>
> AB -\> C
> AC -\> B
> BC -\> A
> BA -\> C
> CA -\> B
> CB -\> A
> A -\> BC
> B -\> AC
> C -\> AB
> -\> ABC
> 2 votes

# Answer
# Japt, 13 12 bytes

```
"ABC"r"[{U}]

```

Saved a byte thanks to ETHproductions.

Try it online!
> 1 votes

# Answer
# APL, 7 bytes

```
'ABC'∘~

```

`~` is set subtraction,  is compose, so this is a function that returns `ABC` minus the characters in its input.
> 1 votes

# Answer
## Jellyfish, 9 bytes

```
PNI
 "ABC

```

Try it online!

In more conventional notation, this program translates to:

```
P(N("ABC", I))

```

`I` is the input, `N` is list difference, and `P` is output.
> 1 votes

# Answer
# Perl 5.9.9 ~~79 38 37~~ 35 bytes

```
perl -le '$_="ABC";eval"y/$ARGV[0]//d";print'

```

(not sure of the counting rules here - have included switches but not the perl command).

```
> perl -le '$_="ABC";eval"y/$ARGV[0]//d";print' AB
C
> perl -le '$_="ABC";eval"y/$ARGV[0]//d";print'
ABC

```

(adjusted counts after adjudication comment below)
> 1 votes

# Answer
## Common Lisp, 71 bytes

The largest entry at the moment, but at least it is readable ;-)

```
(lambda(s)(coerce(set-difference'(#\A #\B #\C)(coerce s'list))'string))

```
> 1 votes

# Answer
## Pyth, 4 bytes

```
-<G3

```

Try it here!

```
 <G3 -  alphabet[:3]
-    - input-^

```

Note this uses lower case which might not be acceptable
> 1 votes

# Answer
# C, 53 bytes

```
b=64;c(char*a){while(b<67)putchar(++b*!strchr(a,b));}

```

If implicit declarations of string.h are not allowed, **72 bytes**, to add `#include<string.h>`

Try it online!

---

or something a bit more fun at **75 bytes**

```
a[128]={};b=64;c(char*d){while(*d)++a[*d++];while(b<67)putchar(b*!a[++b]);}

```

Try it online!
> 1 votes

# Answer
## Batch, 101 bytes

```
@set/ps=
@for %%c in (L E J)do @call set d=%%s:%%c=%%&call:c %%c
:c
@if "%d%"=="%s%" set/pd=%1<nul

```

Takes input on STDIN, which means that `%1` is empty when the code falls through into the helper subroutine and nothing gets printed.
> 1 votes

# Answer
# , ~~47~~ 40 bytes

```
gsub(paste0("[",scan(,""),"]"),"","ABC")

```

Try it online!

Replaces any letters in the input string with the empty string.
> 1 votes

# Answer
# Vyxal, 6 bytes

```
‛ėġ⇧$F

```

Try it Online!

```
     F # Remove from...
‛ėġ⇧   # "ABC"
    $  # The input

```
> 1 votes

# Answer
# Raku, 21 bytes

```
{'ABC'.trans($_=>"")}

```

Try it online!

Transliterates all of the characters in the input string into the null string.
> 1 votes

# Answer
# Lua, 41 bytes

```
print((('LEJ'):gsub('['..(...)..']',''))

```
> 0 votes

# Answer
# Befunge, ~~40~~ 39 bytes

```
~2p~2vv:<_>"C"-#v_@
8p2~p<>,0^g2::+1<*8

```

Try it online!
> 0 votes

# Answer
# PHP, ~~43~~ 40 bytes

```
<?=preg_replace("([Z$argv[1]])","",ABC);

```

`Z` added to character class to work around `missing terminating ]` warning for empty input.

no regex, **43 bytes**:

```
<?=str_replace(str_split($argv[1]),"",ABC);

```
* `str_split` splits input to array of single characters
* `str_replace` replaces all occurences of each array element in `ABC` with the empty string
> 0 votes

# Answer
# VB.Net, 65 bytes

```
Sub F(s)
Console.Write(String.Join("","ABC".Except(s)))
End Sub

```

A subroutine (function) that takes the input string, and removes each character present in the input from the string "ABC". Then it joins the resulting characters back into a string, before printing them to the console.
> 0 votes

# Answer
# Pure bash, 59 bytes

If the newline isn't necessary, removing the final "echo" takes it down to 54 bytes.

```
for i in A B C
{
[ X${1//$i/} = X$1 ] && echo -n $i
}
echo

```
> 0 votes

# Answer
# Clojure, 39 bytes

```
#(apply str((group-by(set %)"ABC")nil))

```

Transforms input string into set of characters, and then uses it as a function by which it groups string "ABC". For example, if the input string is "B" then the result is `{nil [\A \C], \B [\B]}` and all we have to do is take value by key `nil` and convert it to string. Beats Common Lisp!

See it online
> 0 votes

# Answer
## Go, ~~158~~ ~~153~~ ~~151~~ 146 bytes

**condensed:**

```
package main;import(."os";."fmt");func main(){b:=[3]int{65,66,67};for _,e:=range Args[1]{b[e-65]=1};Print(string(b[0])+string(b[1])+string(b[2]))}

```

**uncondensed:**

```
package main

import (
    ."os"
    ."fmt"
)

func main() {
    //A,B,C are represented as 65,66,67 in int
    b := [3]int{65, 66, 67}
    //Loop through the ABC argument.
    for _,e := range Args[1]{
        //Find the letter that exists. If it's A then b[65-65] -> b[0] -> A
        //We replace the integer, with 1 which is equal to an empty string if converted.
        b[e-65] = 1
    }
    //Covert each int to string.
    Print(string(b[0])+string(b[1])+string(b[2]))
}

```
> 0 votes

# Answer
# Scala, 23 bytes

```
(s:String)=>"ABC"diff s

```
> 0 votes

# Answer
## Mathematica 38 Bytes

```
""<>Complement@@Characters/@{"ABC",#}&

```

splits out the characters of the input string and the string "ABC" and performs their complement and a shorthand StringJoin.
> 0 votes

# Answer
# PHP, 61 bytes

```
<?=implode("",array_diff(["A","B","C"],str_split($argv[1])));

```
> 0 votes

# Answer
# perl 5.18, 35 bytes

```
print"ABC"=~s/[@{[shift||" "]}]//gr

```

Examples:

```
perl -le'print"ABC"=~s/[@{[shift||" "]}]//gr' A        # BC
perl -le'print"ABC"=~s/[@{[shift||" "]}]//gr' BC       # A
perl -le'print"ABC"=~s/[@{[shift||" "]}]//gr'          # ABC

```
> 0 votes

# Answer
# Perl 6, 38 bytes

```
say join "","ABC".split(get.split(""))

```

Example found in close to every "remove substring" answer. EDIT: Fixed the mistake when AC it returns ABC
> 0 votes

# Answer
# CJam, 7 bytes

```
"abc"l-

```

Explanation:

```
"abc"l-
"abc"   e#Push ['a','b','c']
     l  e#Push input
      - e#Remove input from ['a','b','c']
        e#Implict output

```
> 0 votes

# Answer
# Gema, 44 characters

```
\A=@set{r;ABC}
?=@set{r;@subst{?=;$r}}
\Z=$r

```

Sample run:

```
bash-4.3$ printf CB | gema '\A=@set{r;ABC};?=@set{r;@subst{?=;$r}};\Z=$r'
A

```
> 0 votes

# Answer
# Bash, 22 bytes

```
x=ABC
echo ${x//[$1]/}

```

Try it online!

# Zsh, 20 bytes

```
x=ABC
<<<${x//[$1]/}

```

Try it online!

Nothing crazy, just remove matches from the string "ABC"
> 0 votes

# Answer
# Japt, 7 bytes

```
"ABC"kU

```

Run it online | Run the testcases

---

As Embodiment of Ignorance pointed out:

**6 bytes** if lowercase input/output is acceptable:

```
`¯b`kU

```

Run it online
> 0 votes

# Answer
# Japt, 7 bytes

Input & output as strings.

```
;3îB kU

```

Try it

Input & output as arrays of characters.

```
3õdI kU

```

Try it
> 0 votes

# Answer
# Ruby, 16 bytes

Inspired by Sean’s Raku answer.

```
$_="ABC".tr$_,""

```

Attempt This Online!
> 0 votes

# Answer
# Thunno 2, 5 bytes

```
ʋABCḍ

```

Try it online!

#### Explanation

```
ʋABCḍ  # Implicit input
ʋABC   # Push "ABC"
    ḍ  # Symmetric set difference
       # Implicit output

```
> 0 votes

---
Tags: code-golf, string, set-theory
---


title: Do you make me up?

text:
# Question
Title: Do you make me up?
# Introduction

Every string has an "alphabet", composed of the characters that make it up. For example, the alphabet of \\$abcaabbcc\\$ is \\${a, b,c}\\$. There are two operations you can do with alphabets: getting the alphabet of a string, and seeing if another string has a given alphabet.

# Challenge

Given two strings, you must write a function that finds the alphabet of the first string, and returns a truthy or falsy value based on whether that alphabet makes up the second string, ie. if the alphabet of the first string is the same as that of the second. However, the function should also return a truthy value if the alphabet of the first string is a superset of, or contains, the alphabet of the second.

* The two strings will be of variable length. They might be empty. If they are, their alphabets are considered and empty list/set. Any valid unicode string could be an input.
* The function must return a truthy or falsy value. Any type of output is OK, as long as, when converted to a boolean in your language (or the equivalent), it is `true`.

# Examples

* `String 1: "abcdef", String 2: "defbca"`
`Output: truthy`
* `String 1: "abc", String 2: "abc123"`
`Output: falsy`
* `String 1: "", String 2: ""`
`Output: truthy`
* `String 1: "def", String 2: "abcdef"`
`Output falsy`
* `String 1: "abcdef", String 2: "abc"`
`Output truthy`
* `String 1: "", String 2: ""`
* `Output: truthy`

# Rules

This is , so shortest answer in bytes wins!

## The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```
## Language Name, N bytes

```

where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:

```
## Ruby, <s>104</s> <s>101</s> 96 bytes

```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:

```
## Perl, 43 + 2 (-p flag) = 45 bytes

```

You can also make the language name a link which will then show up in the snippet:

```
## [><>](https://esolangs.org/wiki/Fish), 121 bytes

```

```
/* Configuration */

var QUESTION_ID = 194869; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
```

```
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
```

```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
```

# Answer
> 25 votes
# Python 3, 21 bytes

```
lambda a,b:{*a}>={*b}

```

Try it online!

## Explanation

# Answer
> 11 votes
# Haskell, 13 bytes

```
all.flip elem

```

Try it online!

Haskell doesn't have built-in set or subset functions, so we need to do it ourselves. This is a pointfree version of

**17 bytes**

```
a%b=all(`elem`a)b

```

Try it online!

which it itself shortened from

**22 bytes**

```
a%b=and[elem c a|c<-b]

```

Try it online!

# Answer
> 8 votes
# Regex (ECMAScript 2018 / Python`regex` / .NET), 20 bytes

Takes the two strings in joined format, delimited by a single newline. That is why there are two newlines in the regex itself (saving 2 bytes compared to if `\n` were used):

```

((.)(?<=\2.*
.*))*$

```

Try it online! \- ECMAScript 2018
Try it online! \- Python `import regex`
Try it online! \- .NET

It just so happens that the order of String 1 and String 2 dictated by this question is the one that makes it a bit nontrivial in regex, impossible to do without variable-length lookbehind or non-atomic lookahead. If it were the other way around, it would be possible in vanilla ECMAScript.

```
\n         # 1. Find the newline, so we can match against String 2
(          # 2. Start loop at the beginning of String 2
  (.)      # 3. At every iteration, capture another character from String 2 into \2
  (?<=     # 4. positive lookbehind - look backwards
    \2.*   # 6. Assert that the captured character \2 can be found in String 1
    \n.*   # 5. Find the newline, so we can match against String 1
  )
)*         # 7. Continue the loop as long as possible
$          # 8. Assert that when the loop has finished, we've reached String 2's end

```

# Regex (Java), 29 or 27 bytes

Java has a limited sort of variable-length lookbehind. It's unlimited in length, but there are strict limits as to what is allowed in a lookbehind (most notably, all backreferences must be inside a lookahead inside the lookbehind), and stricter limits on what will actually work in a lookbehind. So in principle it has the same power as full-fledged variable-length lookbehind in its ability to solve computation problems, but will do so less efficiently.

In this case, two limits come into play: `\2` need to be backreferenced in a lookahead, and apparently, if an expression like `.*x.*` is in a lookbehind (where `x` is any character), it will silently fail to work properly. Here we work around this problem by collapsing the `.*\n.*` into `[\s\S]*`:

```

((.)(?<=^(?=.*\2)[\s\S]*))*$

```

**29 bytes** \- Try it online!

This problem could also be solved by using comma as a delimiter instead of newline:

```
,((.)(?<=^(?=[^,]*\2).*))*$

```

**27 bytes** \- Try it online!

Or by using the `s` (dotall) flag with newline as the delimiter:

```

((.)(?<=^(?=[^
]*\2).*))*$

```

**27 bytes** \- Try it online!

# Regex (PCRE1), 48 bytes + `s` flag

It is possible to emulate variable-length lookbehind using recursive constant-width lookbehind:

```

((.)((?<=(?=
((?<=(?=$.|\2|(?4)).))|(?3)).)))*$

```

Try it online! (C++)
Try it on regex101

The recursive lookbehind goes through two stages in this regex: first `(?3)` to find the newline, and then `(?4)` to find the captured character. The regex could be 1 byte shorter if some character that is guaranteed not to be present in the input were used as the dummy impossible match instead of `$.`.

`/s` single line mode (dotall) is used so that newline can be the delimiter, with the `.` in the lookbehinds being allowed to match it. With any other choice of delimiter (even a control character), this flag would not be needed. Therefore, I have not included it in the byte count. FWIW though, keeping newline as the delimiter and *not* using `/s` mode would require upping the length to 52 bytes (with a regex that runs much more slowly, due to putting the newline after the lookbehind), costing the same in bytes as adding `(?s)` would, thus not worthwhile.

# Regex (PCRE2 / Perl 5), 45 bytes + `s` flag

Same approach as PCRE1, but the dummy impossible match `$.` is no longer needed to avoid a "recursive call could loop indefinitely" error:

```

((.)((?<=(?=
((?<=(?=\2|(?4)).))|(?3)).)))*$

```

Try it online! \- PCRE2 (C++)
Try it online! \- PCRE2 (PHP – doesn't work, and I don't know why)
Try it online! \- Perl 5

# Regex (PCRE2) length-limited, ~~39~~ 38\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

It is possible to emulate molecular lookbehind (and some of the power of variable-length lookbehind) using jaytea's lookahead quantification trick, but this limits the maximum possible length of String 2 to 1023 characters. In the linked blog post I commented (as Davidebyzero) on a way to extend this limit by a couple of orders of magnitude, but it nevertheless remains.

This trick does not work in Perl 5, because apparently it has the same "no empty optional" behavior as ECMAScript. *\[Edit: This isn't true in most circumstances. Needs to be looked into.\]*

1 byte can be saved by omitting the anchor. Any non-match will remain a non-match even if it is attempted from later positions in the first string, because if the second string isn't made up of a subset of the first string's characters, it certainly won't be made up of a smaller subset. This does result in a slowdown for non-matches.

```
((?=(?=.*
(\2?(.?))).*\3)){1,1023}?.*
\2$

```

Try it online! (C++)
Try it online! (PHP)

# Regex (PCRE2) length-limited const, ~~36~~ 35\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

The regex still works with a constant quantifier (for a total length of **39 bytes**), but will take more steps (but not necessarily much more time, depending on the optimization done by the regex engine).

```
((?=(?=.*
(\2?(.?))).*\3)){1149}.*
\2$

```

Try it online! (C++)
Try it online! (PHP)

# Regex (Perl 5 / .NET / Java) length-limited const, ~~34~~ 33\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

This version works in Perl, in which the quantifier can go up to `{32766}` (which would make a regex length of 40 bytes, and still execute fast), and in Java, in which the quantifier apparently can go up to `{400000000165150719}` (but must be much smaller for execution time to be practical).

PCRE1 (and PCRE2 earlier than v10.35), as well as Ruby, treat any quantifer greater than 1 on a lookaround as being 1, so the lookaround must be wrapped in a dummy group, costing 2 bytes. But in Perl 5, .NET, Java, and Python 3, lookarounds can be directly quantified:

```
(?=(?=.*
(\1?(.?))).*\2){9999}.*
\1$

```

Try it online! \- Perl 5
Try it online! \- .NET (C#)
Try it online! \- Java - 1 byte longer – needs the anchor for some reason – this needs investigation

# Regex (PCRE1) length-limited, {~~45 or 42~~ 44 or 41}\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

Due to a fundamental flaw in PCRE1's design, a workaround is needed to prevent the regex from returning truthy when the last character of String 2 is not present in String 1:

```
((?=(?=.*
(\2?(.?))).*\3.*(
\2))){1,481}?.*\4$

```

Try it online! (C++)
Try it on regex101

The regex still works with a constant quantifier, but will take more steps (but not necessarily much more time, depending on the optimization done by the regex engine):

```
((?=(?=.*
(\2?(.?))).*\3.*(
\2))){500}.*\4$

```

Try it online! (C++)
Try it on regex101

# Regex (Ruby) length-limited, ~~50~~ 49\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

The lookahead quantification trick fully works in Ruby, and can go as high as `{100000}`. There is no support for nested backreferences, so `\2` must be copied to `\4` in a lookahead:

```
((?=(?=.*
(\4?(.?))).*\3(?=.*
(\2)))){1,100000}?.*
\2$

```

Try it online!

While Ruby's regex engine does have subroutine calls, and thus at first glance it might appear to be possible to adapt the solutions that emulate variable-length lookbehind to it, it does not appear to be possible to do so. Any attempt at recursion with subroutine calls generates the error "never ending recursion", even when there are clear-cut terminating conditions.

# Regex (Python`regex`) length-limited const, 44\\$+\lfloor log\_{10}L\_{max}\rfloor\\$ bytes

The lookahead quantification trick works in Python 3 (using the `regex` module rather than `re`), but only with a constant quantifier. This is a shame, because Python can go as high as `{4294967294}`, but increasing its value in this regex causes super-exponential slowdown. There is no support for nested backreferences, so just like the Ruby version, `\2` must be copied to `\4` in a lookahead.

```
(?=(?=.*
(\3?(.?))).*\2(?=.*
(\1))){300}.*
\1$

```

Try it online!

# Regex (RegexMathEngine `-xml`), 27 bytes

In RegexMathEngine, molecular (non-atomic) lookahead can be used in the form of `(?*...)` when enabled using the `-xml` command line parameter ("enable extension: molecular lookahead").

This needs to be anchored because the delimiter is inside a negative lookahead, so without the anchor, a non-match could become a match by leapfrogging the delimiter and starting its match within the second string.

```
^(?!(?*.*,(.)+)(?!.*\1.*,))

```

Comma is the delimiter because it is not yet possible to work with strings containing newlines when using command-line invocation of this regex engine (which works as a one-line-at-a-time grep).

# Regex (PCRE2 v10.35+), ~~27~~ 24 bytes

PCRE does not have variable-length lookbehinds, but PCRE2 v10.34 has introduced non-atomic lookarounds in the form of `(*napla:...)` and `(*naplb:...)` (with the added synonyms of `(?*...)` and `(?<*...)` in v10.35), making it also able to solve this problem in the general case. This is shorter than in RegexMathEngine thanks to the use of newline as a delimiter:

```
^(?!(?*.*
(.)+)(?!.*\1))

```

Try it on regex101
Attempt This Online! (PHP)

You can change the delimiter (for example to comma: `^(?!(?*.*,(.)+)(?!.*\1.*,))`), to test on the command line using `pcre2grep`.

# If the strings were in the other order: Regex (ECMAScript / Python), 19 bytes

If String 2 comes before String 1, there is no need for lookbehind or non-atomic lookahead, and the solution is universal to all regex engines that have lookahead. It does now need to be anchored though, because otherwise, any non-match could become a match by discarding the beginning of the first string.

```
^((.)(?=.*
.*\2))*

```

Try it online! \- ECMAScript
Try it online! \- Python

```
^(          # start loop at the beginning of String 2
  (.)       # at every iteration, capture another character from String 2 into \2
  (?=.*\n   # look ahead to String 1 (by finding the newline)
    .*\2    # assert that the captured character \2 can be found in String 1
  )
)*          # continue the loop as long as possible
\n          # assert that when the loop has finished, we've reached String 2's end

```

# Answer
> 6 votes
# Python 3, ~~28~~ 23 bytes

```
lambda x,y:not{*y}-{*x}

```

Try it online!

-5 bytes thanks to Wizzwizz4

## 28 bytes

```
lambda x,y:not set(y)-set(x)

```

Try it online!

Simply turns the two inputs into sets and subtracts the sets from each other

# Answer
> 5 votes
# JavaScript (ES6), 31 bytes

Takes arrays of characters as input.

```
a=>b=>b.every(c=>a.includes(c))

```

Try it online!

---

### 25 bytes

For the record, below is my original answer, which was designed for alphanumeric characters.

```
a=>b=>!b.match(`[^${a}]`)

```

Try it online!

# Answer
> 5 votes
# Brachylog, 3 bytes

```
dp⊆

```

Try it online!

Takes string 1 as the output variable and string 2 as the input variable.

# Answer
> 5 votes
# , 2 bytes

Back then I definitely had the negation instruction. If you think it's boring then continue.

```
t!

```

## Explanation

```
t  % Remove all characters of 1st input that appears in 2nd input.
   % e.g. ['abcdef','abc'] -> 'def'
 ! % Negate the result. So if the resulting string had something,
   % it will return falsy. Otherwise it will yield truthy.

```

# , 4 bytes

W is back, reimplemented!

```
t""=

```

If you want to specify your input and code, you look for imps.py and then re-set those variables like this:

```
read = ["abcabc","abc"]

prog = 't""='

```

Note that your inputs must be in a single array with the joined values.

# Wren, ~~86~~ ~~60~~ ~~30~~ 26 bytes

I didn't expect this. Wren is very hard to golf.

```
Fn.new{|a,b|b.trim(a)==""}

```

Try it online!

## Explanation

```
Fn.new{                    // New anonymous function
       |a,b|               // With parameters a and b
            b.trim(a)      // After removing all characters in a that are in b
                           // (If b can be assembled using a the result should
                           // be a null string; otherwise it should be a
                           // non-empty string.
                     ==""} // Is this result an empty string?

```

# Answer
> 5 votes
# Gaia, 1 byte

Try it online!

Just a built-in. For strings, it checks for character-wise superset.

Test Suite

# Answer
> 5 votes
# Ruby, 21 bytes

```
->x,y{!y.tr(x,"")[0]}

```

The `tr` method replaces all instances of the first string it's passed with the corresponding character in the second string it's passed. So all characters from x are removed from y. If there are any characters left, then it returns the first value (all values are truthy in ruby except `false` and `nil`) and inverses it. And if there are no characters left, then nil is inversed.

Golfy Tricks Implemented:

* Using `y.tr(x,"")` instead of `y.chars-x.chars`
* Using `!array[0]` instead of `array.empty?`

Try it online!

# Answer
> 4 votes
# APL (Dyalog Unicode), 3 bytes

```
×/∊

```

Try it online!

Use it as `string2 f string1`.

### How it works

```
×/∊
  ∊  Does each char of string2 appear in string1?
×/   All of them?

```

# Answer
> 3 votes
# Japt `-!`, ~~15~~ ~~10~~ 5 bytes

```
k@VøX

```

Try it online!

Thanks to @Shaggy for -5.

# Answer
> 3 votes
# , 5 bytes

```
*/@e.

```

Try it online!

Is each char of the 2nd string an element of `e.` the 1st string? This returns a boolean mask, whose elements we multiply together with `*/`. J is smart about 0 values so that if you apply `*/` to the empty list `''` you get `1`.

# , 6 bytes

```
''-:-.

```

Try it online!

Does the empty string `''` match `-:` 1st string "set minused" `-.` from the 2nd?

# Answer
> 3 votes
# PHP (7.4), ~~26~~ ~~25~~ 28 bytes

```
fn($a,$b)=>''>=strtok($b,$a)

```

Try it online!

PHP's strtok, basically removes characters of its second parameter, form its first parameter and returns the result or false if the result is empty. By removing `$a` characters from `$b`, if the result is empty (false), we output a truthy, else a falsy.

Christoph mentioned an issue with output of `'0'` from `strtok` (which equals to false), and to solve it, `''>=` is used instead of a simple NOT (`!`) at a cost of +3 bytes. `''==` would work the same way as well.

# Answer
> 3 votes
# Bracmat, 51 bytes

```
(f=a b.!arg:(?a,?b)&vap$((=.@(!a:? !arg ?)&|F).!b))

```

The function f returns a list of Fs, one F for each character in b that is not in a's alphabet. An empty list means that b's alphabet is contained in a's alphabet. The function vap splits the second argument, which must be a string, in UTF-8 encoded characters if the second argument (!b in this case) is valid UTF-8, and otherwise in bytes.

Try it online!

# Answer
> 3 votes
# C (gcc), ~~94~~ 85 bytes

```
f(a,b,c)int*a,*b,*c;{for(;*b;++b){for(c=a;*c&&*c!=*b;++c);if(!*c)return 0;}return 1;}

```

Try it online!

-9 bytes from JL2210

Returns `int`: `1` for truthy and `0` for falsey.

Note: takes two parameters that are each pointers to null-terminated wide strings (`wchar_t` are the same size as `int` on the platform used on TIO, so we can take the strings as `int*` instead of including `wchar.h` and taking them as `wchar_t*`)

Explanation/Ungolfed:

```
#include <wchar.h>
int f(const wchar_t *a, const wchar_t *b) {
    for ( ; *b != L'\0'; ++b) { // For each character in the second string
        const wchar_t *temp;
        for (temp = a; *temp != L'\0'; ++temp) {
            if (*temp == *b) break;
            // If the character is in the first string,
            // then continue and check the next character
        }
        if (*temp == L'\0') return 0;
        // If the character was not found, return 0 (falsey)
    }
    return 1; // If every character was found, return 1 (truthy)
}

```

# Answer
> 3 votes
# Lua, 75 bytes

```
load'b,a=...return a:gsub(".",load"return not b:find(...,1,1)and [[]]")==a'

```

Try it online!

Now this is a bit messy. `load` is used to create function here, so everything inside is its body. Here, after taking input, following transformation is done: every symbol in second string is checked in first one. If it is found, internal function return `false` and no replacement is done. Otherwise, symbol is removed (replaced with empty string). Resulting string is compared with one passed as input, efficiently checking that no deletions were performed.

TIO link also include test cases.

# Answer
> 2 votes
# Pyth, 7 bytes

```
g.{w.{w

```

Try it online!

First string on first line of input, second string on second line.

# Answer
> 2 votes
# MATL, 3 bytes

```
wmA

```

Try it online! Or verify all test cases.

# Explanation

The code implicitly takes two strings as inputs, s`w`aps them, and verifies if `A`ll the characters in the first string (originally the second input) are `m`embers of the other string.

(A non-empty array containing exclusively ones is truthy in MATL. This would allow omitting `A` if it wasn't for the case with empty inputs).

# Answer
> 2 votes
# CJam, 5 bytes

```
ll\-!

```

Try it online!

Test Suite

### Explanation

```
ll     Read 2 lines of input
  \    Swap their order
   -   Remove from the second input all characters in the first
    !  Negate

```

# Answer
> 2 votes
# Kotlin, 35 bytes

```
{a,b->(b.toSet()-a.toSet()).none()}

```

Try it online!

# Answer
> 2 votes
# PowerShell, 34 bytes

```
param($a,$b)0-notin($b|%{$_-in$a})

```

Try it online!

Takes two arrays of chars as input.

# Answer
> 2 votes
# Whispers v1, ~~50~~ 43 bytes

```
> Input
> Input
>> {2}
>> 3⊆1
>> Output 4

```

Try it online!

**Squeezed pseudo code**:

```
>> Output ( Set(Input2) ⊆ Input 1)

```

**Explanation**:

As always in Whispers, we execute the last line first:

```
>> Output 4

```

Outputs the result of line 4:

```
>> 3⊆1

```

Returns a Boolean representing the result of line 3 being a subset of the result of line 1. Let's evaluate line 1 first:

```
>> Input

```

Takes the first line of the input.

Now line 3:

```
>> {2}

```

This line forms the set of the result of line 2, which takes the next line of input.

So we get the squashed pseudocode:

```
>> Output ( Set(Input2) ⊆ Input 1)

```

# Answer
> 2 votes
# K (ngn/k), 5 bytes

```
~^&/?

```

Try it online!

A tacit function taking two arguments.

* `?` find the indices of the first matches of the right-hand argument in the left-hand argument; returns `0N` (null) if it's not present
* `&/` take the minimum
* `~^` is the minimum not null?

# Answer
> 2 votes
# x86-16 machine code, 14 bytes

```
00000000: 85c9 ac57 518b caf2 ae59 5fe1 f5c3       ...WQ....Y_...

```

**Listing:**

```
85 C9       TEST CX, CX         ; check for empty string
        S_LOOP:
AC          LODSB               ; next char in string 2
57          PUSH DI             ; save first string pointer
51          PUSH CX             ; save first string length
8B CA       MOV  CX, DX         ; put first string length into scan counter
F2 AE       REPNZ SCASB         ; compare string 2 char to each in string 1 until match
59          POP  CX             ; restore first string length
5F          POP  DI             ; restore first string pointer
E1 F5       LOOPZ S_LOOP        ; loop until end of second string OR no matches
C3          RET                 ; return to caller

```

Callable function - input string 1 at `[DI]` length in `DX`, string 2 at `[SI]` length in `CX`. Output `ZF` if Truthy, `NZ` if Falsy.

*Programming note*: if input string 2 is empty, it will (harmlessly) loop 65,535 times in order to correctly return `ZF`. This is because `LOOPcc` decrements before testing for 0 so it must wrap around the 16-bit counter register before reaching 0 again. Otherwise a `JZ` or `JCXZ` after the `TEST` would eliminate this at a cost of +2 bytes, but hey, this is Code Golf not Efficiency Golf.

**Tests:**

Try it online!

# Answer
> 2 votes
# C (gcc), 51 bytes

```
f(a,b)int*a,*b;{return wcschr(a,*b)&&f(a,b+1)|!*b;}

```

Try it online!

In this 51 bytes version I tweaked a little bit the 53 bytes version (see below, former answer) thanks to && :

* At each letter `*b` I check we can find it in string a.
* If not, it means `wcschr(a,*b)` equal 0, so the program will not bother to execute the second part `&&f(a,b+1)` (that allows us to go deeper in the recursive) and so it return 0...
* ...along with `!*b` | NOT of pointer b: if we had arrived at the end of b, the pointer is NULL so we return `0|!NULL <=> 0|1 <=> 1`. If the pointer is not NULL (which means wcschr(a,\*b) previously returned NULL before string a's \0) then we return `0|!PTR <=> 0|0 <=> 0`

# C (gcc), 53 bytes

```
f(a,b)int*a,*b;{return*b&&wcschr(a,*b)?f(a,b+1):!*b;}

```

Try it online!

This is a recursive function

* `wcschr(a,*b)` looks for unicode character \*b in string a, return NULL character is not found, else pointer to the character (!=NULL).
* We keep looking if 1/ we are not at the end of string b `(*b!=NULL)` and 2/ while we keep finding our char \*b in string a.
* If both conditions are true we inspect our next character in string b `f(a,b+1)`
* if not we return NOT of the pointer to \*b : if we had arrived at the end of b then \*b is NULL and our function return true, if not it means that wcschr failed before reaching end of string b.

NB: wcschr is the builtin function equivalent of strchr (man strchr)

```
#include <wchar.h>
#ifndef WCSCHR
# define WCSCHR __wcschr
#endif
/* Find the first occurrence of WC in WCS.  */
wchar_t *
WCSCHR (const wchar_t *wcs, const wchar_t wc)
{
  do
    if (*wcs == wc)
      return (wchar_t *) wcs;
  while (*wcs++ != L'\0');
  return NULL;
}
libc_hidden_def (__wcschr)
weak_alias (__wcschr, wcschr)
libc_hidden_weak (wcschr)

```

# Answer
> 1 votes
# Jelly, 3 bytes

```
fƑ@

```

Try it online!

A dyadic link taking two strings and returning a Boolean. If the order of the input s can be reversed, I could save one byte.

Works by checking whether the second string is unchanged when filtering to just the characters in the first.

# Answer
> 1 votes
# Charcoal, 5 bytes

```
⬤η№θι

```

Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. `-` for true, nothing for false. Explanation:

```
⬤       All of
 η      Second string
  №     Count (is non-zero) in
   θ    First string of
    ι   Character of second string
        Implicitly print

```

# Answer
> 1 votes
# Zsh, 35 bytes

```
a=(${(s::)1})
((!${#${(s::)2}:|a}))

```

Try it online!

```
      ${(s::)2}        # split second parameter into characters
   ${          :|a}    # remove all elements of $a
   ${#            }    # count
((!                ))  # return truthy if 0, falsy if non-zero

```

# Answer
> 1 votes
# Perl 5, 53 bytes

```
sub{local$_=pop;eval"y/@{[quotemeta pop]}//d";!y///c}

```

Try it online!

# Answer
> 1 votes
# Lua, 114 bytes

```
d=function(a,c,v)for _,k in ipairs(a) do c[k]=v end end
function l(a,b)c={};d(b,c,1);d(a,c);return not next(c) end

```

Try it online!

Couldn't get it shorter with plain Lua because lightweight Lua knows few builtins. If it needs to work with strings:

# Lua, 116 bytes

```
function d(a,c,v)for _,k in a:gmatch"." do c[k]=v end end
function l(a,b)c={};d(b,c,1);d(a,c);return not next(c) end

```

Try it online!

# Answer
> 1 votes
# Haskell, 24 bytes

```
f a b=all(\c->elem c a)b

```

Try it online!

# Answer
> 1 votes
# Japt `-!`, 3 bytes

```
VkU

```

Try it

```
VkU   U = first string, V = second
Vk    Remove all characters in V
  U   that are present in U
-!    If the string is empty, return true, else false

```

# Answer
> 1 votes
# , 40 bytes

```
function(x,y,`+`=utf8ToInt)all(+y%in%+x)

```

Try it online!

# Answer
> 1 votes
# Keg, ~~13~~ ~~7~~ ~~5~~ ~~4~~ 3 bytes

```
-⑫=

```

-1 byte due to the new  operator that pushes an empty string

## Answer History

### 4 bytes

```
-``=

```

Try it online!

*-1 byte with trailing newline*

And y'all thought W could beat Keg!

This one's a bit of a stretch, as it uses a footer and header to define a function. I'll explain later.

## Answer History

### 7 bytes (SBCS)

```
᠀᠀^-``=

```

Try it online!

-6 bytes due to the fact I realised I could just compare the result to an empty string.

**Explained**

```
᠀᠀^-``=
᠀᠀      #Take the two input strings
  ^     #Reverse stack to place strings in correct input order
   -    #Subtract the first string from the second
    ``= #Compare the result to an empty string, pushing either 1 or 0

```

### 13 bytes (SBCS)

```
᠀᠀^-÷!&ø&[0|1

```

Try it online!

Uses features from Keg, Reg and Keg+!

**Explained**

```
᠀᠀^-÷!&ø&[0|1
᠀᠀              #Take the two strings as input
  ^             #Reverse the stack so that string subtraction works
   -÷           #Subtract first input from second and item split the result
     !          #Push the length of this splitted string
      &ø&       #Safely store this length in the register while clearing the stack
         [0|1   #Push 0 if there are still items otherwise 1 if empty string

```

# Answer
> 1 votes
# Perl 6, 17 bytes

```
!(*R∖*)o**.comb

```

Try it online!

Also known as Raku. Anonymous code object taking two arguments and returning a boolean.

### Explanation:

```
       **.comb   # Map each string to a list of characters
      o          # Then return if
  *R∖*           # The second argument set minus the first
!(    )          # Is empty?

```

# Answer
> 1 votes
# C# (.NET Core), ~~52 bytes~~ ~~46 bytes~~ 53 bytes

```
static bool f(string a, string b)=>b.All(a.Contains);

```

Try it online!

# Answer
> 1 votes
# Julia 1.0, 19 bytes

```
x\y=all(c->c∈x,y)

```

Try it online!

Thought I beat python till I saw xnor's answer! Uses a generator to check if every character in `y` exists in () `x`. Explanation: pass an anonymous function that checks if `c` is in `x` as the predicate to `all`, check that it returns true for all values in y.

Previous 22 byte solution: `x\y=all(c∈x for c=y)`

Try it online!

# Answer
> 1 votes
# Java, 90 Bytes

```
(String[] a)->a[1].chars().filter(x->!a[0].contains((String.valueOf((char)x)))).count()<1;

```

Try it online!

Not great, but chars() helps some...

# Answer
> 1 votes
# 05AB1E, 4 bytes

```
€ê`å

```

Try it online! or verify all test cases

**Explanation**

```
€ê    Remove duplicates and sort each input
  `   Dump alphabets to the stack
   å  Check if the 2nd alphabet is contained in the 1st one

```

# Answer
> 1 votes
# Clojure, 39 Bytes

```
(fn[a b](every? #(contains?(set a)%)b))

```

Try it online!

# Answer
> 1 votes
# Perl 5, ~~46~~ ~~41~~ 39 bytes

*-2 bytes thanks to dingledooper*

```
sub{pop.'␀'.pop~~/^((.)(?=.*␀.*\2))*␀/}

```

Try it online!

This uses the ECMAScript / Python / universal regex from my pure regex answer (explained there). The unprintable character NUL (ASCII 0) is used as the delimiter, shown here as .

# Answer
> 1 votes
# Kotlin, 50 bytes

```
{s1:String,s2:String->s2.filter{it !in s1}.none()}

```

Try it online!

# Answer
> 1 votes
# Wolfram Language (Mathematica), 7 bytes

```
SubsetQ

```

Try it online!

`SubsetQ` does not account for multiplicity.

# Answer
> 1 votes
# Java, ~~57~~ ~~49~~ 48 bytes

```
a->b->(b+'␀'+a).matches("((.)(?=.*␀.*\\2))*␀.*")

```

Try it online!

This uses the ECMAScript / Python / universal regex from my pure regex answer.

An actual NUL (ASCII 0) character is used as the delimiter for maximum universality. This is inserted directly into the TIO test harness as actual NUL characters, but displayed above using the  glyph for visibility.

# Answer
> 1 votes
# Vyxal, 2 bytes

Try it online or verify all test cases.

# Answer
> 0 votes
# Rust, ~~106~~ 104 bytes

```
|a:&str,b:&str|{let c=|x:&str|x.chars().collect::<std::collections::HashSet<_>>();c(b).is_subset(&c(a))}

```

Try it online!

# Answer
> 0 votes
# Scala, 46 bytes

```
(a:String,b:String)=>(b.toSet&~a.toSet)==Set()

```

Try it online!

# Answer
> 0 votes
# Prolog (SWI), 92 bytes

```
e(_,[]).
e(L,[H|T]):-member(H,L),e(L,T).
f(X,Y):-string_chars(X,A),string_chars(Y,B),e(A,B).

```

Try it online!

# Answer
> 0 votes
# Python 2.7 .pyc file, 130 bytes

Sorry, bytecode formats are just too much fun to pass up for simpler tasks

Hexdump because there's plenty of nulls :)

```
00000000: 03f3 0d0a fb0b 8b59 6300 0000 0000 0000  .......Yc.......
00000010: 0004 0000 0040 0000 0073 1a00 0000 7400  .....@...s....t.
00000020: 0074 0100 6302 0083 0000 8301 0003 8300  .t..c...........
00000030: 0083 0100 6b05 0046 2800 0000 0028 0200  ....k..F(....(..
00000040: 0000 7303 0000 0073 6574 7309 0000 0072  ..s....sets....r
00000050: 6177 5f69 6e70 7574 2800 0000 0028 0000  aw_input(....(..
00000060: 0000 2800 0000 0073 0000 0000 7308 0000  ..(....s....s...
00000070: 003c 6d6f 6475 6c65 3e00 0000 0073 0000  .<module>....s..
00000080: 0000                                     ..

```

Optimizations over the in built compiler:

* Stack juggling the functions
* Zero byte filename because it's valid
* Crashing at the end because why spend a byte exiting cleanly

python-xdis output for the file:

```
# pydisasm version 4.1.0
# Python bytecode 2.7 (62211)
# Disassembled from Python 2.7.15+ (default, Jul  9 2019, 16:51:35)
# [GCC 7.4.0]
# Timestamp in code: 1502284795 (2017-08-09 13:19:55)
  0:
            LOAD_GLOBAL          (set)
            LOAD_GLOBAL          (raw_input)
            DUP_TOPX             2
            CALL_FUNCTION        0 (0 positional, 0 named)
            CALL_FUNCTION        1 (1 positional, 0 named)
            ROT_THREE
            CALL_FUNCTION        0 (0 positional, 0 named)
            CALL_FUNCTION        1 (1 positional, 0 named)
            COMPARE_OP           (>=)
            PRINT_EXPR

```

With bytes to make it easier to see where byte saves could be

```
# pydisasm version 4.1.0
# Python bytecode 2.7 (62211)
# Disassembled from Python 2.7.15+ (default, Jul  9 2019, 16:51:35)
# [GCC 7.4.0]
# Timestamp in code: 1502284795 (2017-08-09 13:19:55)
  0:           0 |74 00 00| LOAD_GLOBAL          (set)
               3 |74 00 01| LOAD_GLOBAL          (raw_input)
               6 |63 00 02| DUP_TOPX                  2
               9 |83 00 00| CALL_FUNCTION        (0 positional, 0 named)
              12 |83 00 01| CALL_FUNCTION        (1 positional, 0 named)
              15 |03      | ROT_THREE
              16 |83 00 00| CALL_FUNCTION        (0 positional, 0 named)
              19 |83 00 01| CALL_FUNCTION        (1 positional, 0 named)
              22 |6b 00 05| COMPARE_OP           (>=)
              25 |46      | PRINT_EXPR

```

# Answer
> 0 votes
# Factor \+ `math.unicode`, 3 bytes

Try it online!

An alias for `superset?`.

# Answer
> 0 votes
# Thunno 2 `!`, 1 byte

Try it online!

#### Explanation

```
   # Implicit input
ṗ  # Set difference
   # Logical NOT
   # Implicit output

```

---
Tags: code-golf, string, decision-problem
---