Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My:
- import scala.collection.mutable.ListBuffer
- object Meeting {
- def meeting(s: String): String = {
- var splited = s.split(';').toList
- var l:ListBuffer[String]=new ListBuffer[String]
- def splitting(NS: List[String]): List[String] = {
- if (NS.nonEmpty) {
- l.append(("("+NS.head.split(':')(1)+", "+NS.head.split(':')(0)+")").toUpperCase())
- splitting(NS.tail)
- }
- else l.sorted.toList
- }
- def print(d:List[String], str:String):String={
- if (d.nonEmpty) print(d.tail, str+d.head)
- else str
- }
- print(splitting(splited), "")
- }
- }
- Other:
- object Meeting {
- def meeting(s: String): String = {
- val u: Array[String] = s.toUpperCase().split(";")
- val v = u.map((x) => x.split(":")).map { case Array(f1,f2) => (f2,f1) }
- v.sortBy(r => (r._1, r._2)).map(r => "(" + r._1 + ", " + r._2 + ")").mkString("")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement