### 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

# Prove commutativity on this monoid presentation.

+2
−0

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ from $S$.

For example for $A=100$ and $B = 010$, one solution is $S = 10101010$ since

$$(10101)010 \rightarrow 010$$$$10(10101)0 \rightarrow 100$$

For a more complex example if $A = 1100$ and $B = 0101$, then one solution is $S = 11010101010101$ since

$$110(10101)010101 \rightarrow 1100(10101) \rightarrow 1100$$$$1(10101)01010101 \rightarrow (10101)0101 \rightarrow 0101$$

There are multiple solutions to every possible input, but there is no requirement that the output be any particular one, only that it satisfy the requirements.

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

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?