import scala.io.StdIn object Main { def main(args: Array[String]): Unit = { val line: String = StdIn.readLine() // 正则指定两种分隔符,用 | 隔开 val strs: Array[String] = line.split(";|,") val id: String = strs(0) val score1: Float = strs(1).toFloat val score2: Float = strs(2).toFloat val score3: Float = strs(3).toFloat println("The each subject score of No. %s is %.2f, %.2f, %.2f.".format(id, score1, score2, score3)) } }