๐ŸŒฑ → ๐ŸŒณ

[๋ฐฑ์ค€] 1157๋ฒˆ: ๋‹จ์–ด ๊ณต๋ถ€ python ๋ณธ๋ฌธ

Algorithms

[๋ฐฑ์ค€] 1157๋ฒˆ: ๋‹จ์–ด ๊ณต๋ถ€ python

BAY 2022. 7. 15. 17:39
728x90

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

 

1157๋ฒˆ: ๋‹จ์–ด ๊ณต๋ถ€

์•ŒํŒŒ๋ฒณ ๋Œ€์†Œ๋ฌธ์ž๋กœ ๋œ ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง€๋ฉด, ์ด ๋‹จ์–ด์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋œ ์•ŒํŒŒ๋ฒณ์ด ๋ฌด์—‡์ธ์ง€ ์•Œ์•„๋‚ด๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ๋‹จ, ๋Œ€๋ฌธ์ž์™€ ์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๋Š”๋‹ค.

www.acmicpc.net

 

์ •๋‹ต ์ฝ”๋“œ:

word = input().upper()
uni = list(set(word))
cnt=[]
for i in uni:
  count = word.count(i)
  cnt.append(count)
if cnt.count(max(cnt))>1:
  print("?")
else:
  max_index=cnt.index(max(cnt))
  print(uni[max_index])
728x90