# [Japt], 10 bytes r"%d*$" +V [Try it online!][TIO-j3lrkje5] r"%d*$" +V Ur"%d*$" +V # Implicit input (U and V) r # Remove "%d*$" # any trailing digits U # from the first input +V # And append the second input # Implicit output [Japt]: https://github.com/ETHproductions/japt [TIO-j3lrkje5]: https://tio.run/##y0osKPn/v0hJNUVLRUlBO@z/f6XEpGQlHQUlE1MzJQA "Japt – Try It Online"