Skip to content

Instantly share code, notes, and snippets.

@myeesan
Created August 29, 2014 13:00
Show Gist options
  • Save myeesan/9c1928f09d2d7f58cde4 to your computer and use it in GitHub Desktop.
Save myeesan/9c1928f09d2d7f58cde4 to your computer and use it in GitHub Desktop.
object Comments extends App {
var before = "";
var count = 0
var result = "";
for (c <- Source.in2) {
if (count == 0) {
result += (c + "")
}
(before + c) match {
case "/*" =>
count += 1
if (1 == count) result = result.init.init
before = ""
case "*/" if count > 0 =>
count -= 1
before = ""
case _ =>
before = c.toString
}
}
println("Case #1:\n" + result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment