Skip to main content
7 of 8
ahh yes it all makes sense now
roblogic
  • 4k
  • 18
  • 23

Bash 4+, 77 bytes

Replaces first char of the first (non-empty) input string with 1,2,3 until no match is found to either input. Try it Online!

-9, -12, -9, -8 bytes all thanks to GammaFunction

x="${1:-$2}"
for s in {1..3}"${x:1}"
{ [[ $s = @($1|$2) ]]||break;}
echo "$s"

(quite an improvement over the original...)

roblogic
  • 4k
  • 18
  • 23