### Communities

tag:snake search within a tag
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
created:<1w created < 1 week ago
post_type:xxxx type of post
Challenges

# Are these reduced forms of the same thing?

+2
−0

You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removing contiguous instances of $X$ in $S$. For example if $X = 10101$ then both $10$ and $01$ can be formed from the starting string $S = 1010101$

$$10\,\,(10101) \rightarrow 10$$$$(10101)\,\,01 \rightarrow 01$$

Input may be either a list of positive integers or a string of alphanumberic ascii characters. Output should be one of two distinct consistent values for each of the cases. One value should be given if an $S$ exists, and the other if not.

This is code-golf. The goal is to minimize the size of your source code as measured in bytes.

# Test cases

## True

The following cases should give a true value. In each I give an example $S$, but this is neither input nor output, it is just provided for demonstration.

A, B, X -> S
10, 0110, 01 -> 0110
10, 001110, 01 -> 001110
10, 01, 10101 -> 1010101
1100, 0101, 10101 -> 11010101101010110101011010101
102, 021, 1021021 -> 1021021021
10, 01, 1010101 -> 101010101

## False

A, B, X
100, 01, 10101
10201, 1100, 10
10, 01, 001
10, 01, 1010
Why does this post require moderator attention?