On Code Signal, this algorithm It does not pass one of the last performance tests.. Probably caused by if statements inside loop, but maybe "indexOf" is the proble