Code modified
improve some string algorithm