the longest substring alg was implemented