algorithm about string