Kotlin Straightforward Solution
Code
# Code
```kotlin []
class Solution {
    fun countTime(time: String): Int {
        val markIndices = (0 until time.length)
            .filter { time[it] == '?' }
            .toSet()
        var res = 0
        for (hh in 0 until 24) {
            for (mm in 0 until 60) {
                val curTime = arrayOf(
                    when {
                        hh in 0..9 -> "0" + hh
                        else -> hh.toString()
                    }, when {
                        mm in 0..9 -> "0" + mm
                        else -> mm.toString()
                    }
                ).joinToString(":")
                
                val differIndices = (0 until time.length)
                    .filter { curTime[it] != time[it] }
                    .toSet()
                if (differIndices == markIndices) res += 1
            }
        }
        return res
    }
}

```
['Kotlin']