object Solution {
  import scala.collection.mutable.BitSet

  def stringReduction(s: String): String = {
    val charSet = BitSet.empty
    for (c <- s if !charSet(c)) yield {
      charSet += c
      c
    }
  }

  def main(args: Array[String]) {
    val s = readLine
    println(stringReduction(s))
  }
}

Add solution to first solution to fp/recursion domain problem. It's much elegant to for comprehension to accomplish this functionality. Will consider a recursion version.
Add solution to first solution to fp/recursion domain problem. It's much elegant
to for comprehension to accomplish this functionality. Will consider a recursion
version.
