Finding substring in string stupid algo