fork(1) download
  1. object Main extends App {
  2. def replace(str: String): String = {
  3. val regex = """(\w{3})(\w)(\w*)""".r
  4. regex.replaceAllIn(str, _ match {
  5. case regex(s1, _, s2) =>
  6. s"$s1#$s2"
  7. })
  8. }
  9. println(replace("op hui mat ego shluha"))
  10. }
Success #stdin #stdout 0.39s 322432KB
stdin
Standard input is empty
stdout
op hui mat ego shl#ha