# Bash 4+, 104 bytes Replaces first char of the first (non-empty) input string with 1,2,3 until no match is found to either input * *saved 11 bytes thanks to ideas from GammaFunction* ``` [ ${#1} = 0 ]&&shift; x="$1" for((;i++<4;)){ o=$i${x:1} [[ $o = $1 ]]||[[ $o = $2 ]]||{ echo $o;exit;} } ``` [Try it Online!][1] [1]: https://tio.run/##PYu7CoQwEAD7/YrFW3xg44qVe/kSSXGKklQBtQjEfPteuOKagRmY9XM51QUpvTijwQFtXV/OH7dANBVxBUc421Z8378n6boEwZCnFGfOsJQxlIsYrX2ev44/TbhvLpQke/S3ZMiq2jCKcsEX