longest substr with n distinct chars