Terminates gracefully when empty inputs