def iter
(a1
: List
[String
], a2
: List
[String
], acc
: Int
): Int
= {
else if(a1.
contains(a2.
head)) iter
(a1, a2.
tail, acc+
1) else iter
(a1, a2.
tail, acc
) }
def nOfEqual
(a1
: List
[String
], a2
: List
[String
]): Int
= iter
(a1, a2,
0)
def main
(a
: Array
[String
]) = { val file1
= scala.
io.
Source.
fromFile(a
(1),
"utf-8").
getLines.
toList val file2
= scala.
io.
Source.
fromFile(a
(2),
"utf-8").
getLines.
toList print("Copied "+nOfEqual(file1, file2)/file1.length.toDouble+"%")
}
}
b2JqZWN0IE1haW4gewoJCglkZWYgaXRlcihhMTogTGlzdFtTdHJpbmddLCBhMjogTGlzdFtTdHJpbmddLCBhY2M6IEludCk6IEludCA9IHsKCQkKCQlpZihhMi5sZW5ndGggPT0gMCkgYWNjCgkJZWxzZSBpZihhMS5jb250YWlucyhhMi5oZWFkKSkgaXRlcihhMSwgYTIudGFpbCwgYWNjKzEpCgkJZWxzZSBpdGVyKGExLCBhMi50YWlsLCBhY2MpCgl9CgkKCWRlZiBuT2ZFcXVhbChhMTogTGlzdFtTdHJpbmddLCBhMjogTGlzdFtTdHJpbmddKTogSW50ID0gaXRlcihhMSwgYTIsIDApCgkKCWRlZiBtYWluKGE6IEFycmF5W1N0cmluZ10pID0gewoJCXZhbCBmaWxlMSA9IHNjYWxhLmlvLlNvdXJjZS5mcm9tRmlsZShhKDEpLCAidXRmLTgiKS5nZXRMaW5lcy50b0xpc3QKCQl2YWwgZmlsZTIgPSBzY2FsYS5pby5Tb3VyY2UuZnJvbUZpbGUoYSgyKSwgInV0Zi04IikuZ2V0TGluZXMudG9MaXN0CgkJcHJpbnQoIkNvcGllZCAiK25PZkVxdWFsKGZpbGUxLCBmaWxlMikvZmlsZTEubGVuZ3RoLnRvRG91YmxlKyIlIikKCX0KfQ==