fork download
  1. object Main extends App {
  2. @scala.annotation.tailrec
  3. def trimAnus(str: String): String = str.lastOption match {
  4. case Some(' ') | Some('\t')
  5. trimAnus(str.dropRight(1))
  6.  
  7. case _
  8. str
  9. }
  10.  
  11. println(s"`${trimAnus("124325 345 \t")}`")
  12. }
Success #stdin #stdout 0.42s 322496KB
stdin
Standard input is empty
stdout
`124325 345`