title: Check for duplicate characters in string using for-loops in swift
body: <p>I did this using while loops but I'm wondering if there's a way to do this with for loops. I'm trying to write this clean so I can write it on a whiteboard for people to understand.</p>
  
  <pre><code>var str = "Have a nice day"
  
  func unique(_ str: String) -&gt; String {
  var firstIndex = str.startIndex
  
  while (firstIndex != str.endIndex) {
      var secondIndex = str.index(after: firstIndex)
      while (secondIndex != str.endIndex) {
          if (str[firstIndex] == str[secondIndex]) {
              return "Not all characters are unique"
          }
          secondIndex = str.index(after: secondIndex)
      }
      firstIndex = str.index(after: firstIndex)
  }
  return "All the characters are unique"
  }
  
  print("\(unique(str))")
  </code></pre>