Map for storing letter and its index in a str

if find the repetitive letter
          then get the index of the letter that previously stored in
the map
          replace i to the index of previously stored letter
          in the next round, loop will start with i + 1