Kotlin/Kotlin 알고리즘

백준 25277번 Culture shock

kimc 2022. 10. 5. 23:48

```

백준 25277번 Culture shock

```

Kimc Kotlin Study

이번 글을 통해 배워갈 내용

  1. 백준 25277번 풀이

https://www.acmicpc.net/problem/25277

 

25277번: Culture shock

Thore is a visiting scholar at a progressive university, whose administrators have decided that gendered pronouns are politically incorrect. The pronouns he, she, him, and her must be replaced with the gender neutral they and them. Thore doesn't want to ap

www.acmicpc.net

 

백준 25277번 Culture shock는

난이도 브론즈 등급의 문제로서

 

주어진 문자열 리스트에서

he, him, she, her을 카운팅 해주면 되는 문제입니다.

 

 


30분 정도 위에 링크를 방문하셔서 풀어보시고

안 풀리시는 경우에만 아래 해답을 봐주시면 감사하겠습니다.


입력을 받고 스트림 필터를 돌려서 숫자를 세서 출력했습니다.

 

 

fun main(args: Array<String>) {
    val cnt = readln().toInt()
    val words = readln().split(" ")
    print(words.filter { s -> arrayOf("he", "him", "she", "her").contains(s) }.size)
}

// https://codemasterkimc.tistory.com/

 

 

읽어주셔서 감사합니다

 

무엇인가 얻어가셨기를 바라며

 

오늘도 즐거운 코딩 하시길 바랍니다 ~ :)

 


 

728x90