Find longest substring with at most k distinct | Snowflake