Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Solution {
- def main(args: Array[String]) {
- def solve(s: String):Int = {
- s.foldLeft((0, ""))( (acc , c) => {
- val (cnt, acstr) = acc
- if (acstr.length() >= 1 && acstr.charAt(acstr.length()-1) == c) (cnt+1, c.toString)
- else (cnt, c.toString)
- })._1
- }
- val x = scala.io.Source.stdin.getLines().drop(1).map(solve(_)).map(println(_)).toList
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement