Python/백준 (BOJ)

[BOJ][B2]줄임말 만들기 - 3181

ㅋㅋ! 2025. 9. 24. 13:00

 

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

문제 전문은 링크 참조

문제가공

  1. 문자열을 입력받는다
  2. 첫번째 단어는 제외하고, 특정 단어들은 제외 시킨다
  3. 각 단어의 첫번째 알파벳을 대문자로 출력한다.

코드작성

exclude_word =['i', 'pa', 'te', 'ni', 'niti', 'a', 'ali', 'nego', 'no', 'ili']
words = input().split()
f = words.pop(0)
arr = filter(lambda x: x not in exclude_word,words)
s = f[0].upper() + ''.join([i[0].upper() for i in arr])
print(s)

'Python > 백준 (BOJ)' 카테고리의 다른 글

[BOJ][B2]LUKA - 3234  (0) 2025.09.26
[BOJ][B2]dates - 3183  (0) 2025.09.25
[BOJ][B2]상근이의 체스판 - 3076  (0) 2025.09.23
[BOJ][B2]수 뒤집기 - 3062  (0) 2025.09.22
[BOJ][B2]백설 공주와 일곱 난쟁이 - 3040  (0) 2025.09.21