how to find first repeating character