 print(isPalindrome0(X("GoHangaSalamiimalaSagnaHoG")))
 
 func isPalindrome1<
-  S : Collection
-  where
-  S.Index : BidirectionalIndex,
-  S.Iterator.Element : Equatable
->(seq: S) -> Bool {
-
-  var a = PermutationGenerator(elements: seq, indices: seq.indices)
+  S : BidirectionalCollection
+  where
+  S.Iterator.Element : Equatable,
+  S.Indices.Iterator.Element == S.Index
+>(seq: S) -> Bool {
+
+  let a = PermutationGenerator(elements: seq, indices: seq.indices)
   var b = seq.lazy.reversed().makeIterator()
   for nextChar in a {
     if nextChar != b.next()! {

  }
}

struct X : Collection {
  typealias Element = String.CharacterView.Iterator.Element
  typealias Index = String.Index
  var msg: String

  }
  subscript(i: Index) -> Element { return msg[i] }
  func next(i: Index) -> Index { return msg.next(i) }
  func previous(i: Index) -> Index { return msg.previous(i) }
}

var foobar = X("foobar")
