Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Challenge #137 [Easy] String Transposition (http://redd.it/1m1jam)

View StringTransposition.scala
1 2 3 4 5 6 7 8 9 10 11
package dailyprogrammer
 
import scala.io.Source
 
object StringTransposition extends App {
val words = Source.fromFile("D:/file.txt").getLines.toList.tail
val longestWord = words.maxBy(_.size)
val wordsTransposed = words.map(_.padTo(longestWord.size, ' ').toList).transpose
 
println(wordsTransposed.map(_.mkString).mkString("\n"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.