-
Notifications
You must be signed in to change notification settings - Fork 0
/
hr_mingle.scala
43 lines (34 loc) · 974 Bytes
/
hr_mingle.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
import scala.io.StdIn.readLine
object Solution {
def mingle(str1: String, str2: String): String = {
return str1.zip(str2)
.map(r => (r._1.toString + r._2.toString))
.reduce((a, b) => a + b)
}
def main(args: Array[String]) {
val s1 = readLine()
val s2 = readLine()
println(mingle(s1, s2))
return
}
}
*/
import scala.io.StdIn.readLine
object Solution {
def mingle(str1: String, str2: String): Unit = {
str1.zip(str2).foreach(r=> print("%s%s".format(r._1, r._2)))
//def mingle(str1: String, str2: String): String = {
//return str1.zip(str2)
// .map(r => (r._1.toString + r._2.toString))
// .mkString
// //.reduce((a, b) => a + b)
}
def main(args: Array[String]) {
val s1 = readLine()
val s2 = readLine()
mingle(s1, s2)
//println(mingle(s1, s2))
return
}
}