ByteDance Interview Question

implement an input with auto-completion function