! update fix bugs and refactor codes
1 trim spaces in input
2 do not search duplicate strings
3 refactor codes