Kotlin Heroes 5: ICPC Round B. Polycarp and the Language of Gods Time : O(n) Space : O(1) 1234567891011121314151617181920212223fun solve(s: String) : Int { val n = s.length var res = 0 var i = 0 while(i < n) { if(s[i] == 'w') { res++; } else if(s[i] == 'v' && (i + 1 != n && s[i + 1] == 'v')) { res++; i += 1; } i++; } return res;}fun main(args: Array<String>) { val tc = readLine()!! for(i in 1 .. tc.toInt()) { val s = readLine()!! println(solve(s)) }}