Adding lognest substring without repeating char