• Home
  • About
    • Moon photo

      Moon

      개발자는 자고 싶다.

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • Posts
    • All Posts
    • All Tags
  • Projects

백준 - 8958 OX퀴즈

07 Jun 2022

Reading time ~1 minute

문제

8958 OX퀴즈

screencapture

답

kotlin code

import java.util.*

fun main() {
    q8958()
}

fun q8958() = with(Scanner(System.`in`)) {
    val count = nextInt()
    val questions = Array(count){next()}
    val result = Array(count){0}
    
    for(i in 0 until count) {
        var point = 0;
        for(j in questions[i].toCharArray()) when(j) {
            'X' -> point = 0
            'O' -> result[i] += ++point
        }
        println(result[i])
    }
}


baekjoonkotlin코틀린백준브론즈구현문자열 Share Tweet +1