# Bash, <s>115</s> .. 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!][2] ***-9, -12, -9, -8** bytes all thanks to [GammaFunction][1]* ``` x="${1:-$2}" for s in {1..3}"${x:1}" { [[ $s = @($1|$2) ]]||break;} echo "$s" ``` (quite an improvement over the [original...][3]) [1]: https://codegolf.stackexchange.com/users/86147/gammafunction [2]: https://tio.run/##dYxBDoIwEEX3PcVPbTK6wKSww5h4D@MC6JgSsRCLigHOjkVjogtn@d@bl2feTndbVowLZwZV6XgDUwu@ZRU8t4giSDXPcuq2UvU6jVQ8SnGsL/AoHXq9XidjIF2qw95jv4fy2GK3VHpQ8QqHwzDkIX/ajIILW4egl9PVzflujghTO56IQHxu2gfh@xYg/VoFsTMeCNq9bC18kxXs6SW8gfj809@EDjD@pW8hIfEE [3]: https://gist.github.com/roblogic/c856c9607b5d29ff856d1c45c8807a75