Hackerrank – String Mingling
Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Iterate through one of the strings and concatenate each actual character. I created solution in: Scala All solutions are also available on my GitHub. Scala
1 2 3 4 5 6 7 8 9 10 |
import scala.io.Source object StringMingling extends App { val lines = Source.stdin.getLines().toList val p = lines.head val q = lines.tail.head val mingled = p.indices.map(i => p(i) + "" + q(i)).mkString("") println(mingled) } |