Optimize find first non repeated charactrer in string