Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object MainObject {
- def main(args: Array[String]): Unit = {
- println("Please write a number and number lines")
- val inputLines = readInt
- var lines : List[String] = List()
- for(i <- 0 until inputLines){
- lines = lines :+ readLine().toString()
- }
- val chars = lines.map( _.toList ).toSeq
- consume(chars)
- }
- def consume(lines: Seq[List[Char]]) : Unit = {
- lines.foreach(
- l =>
- print(l.headOption.map( _.toString ).getOrElse(" "))
- )
- println()
- if (lines.filter( _.length > 0 ).nonEmpty) consume( lines.map( _.drop(1) ) )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement