You are viewing a single comment's thread. Return to all comments →
//scala code
def main(args: Array[String]) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
val count = scala.io.StdIn.readInt var line = "" while ({line = scala.io.StdIn.readLine(); line != null}) { val result=perm(line) println(result) } def perm(s: String): String = { s.sliding(2, 2) .toList .flatMap(_.reverse) .mkString("") } }
Seems like cookies are disabled on this browser, please enable them to open this website
String-o-Permute
You are viewing a single comment's thread. Return to all comments →
//scala code
def main(args: Array[String]) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */