MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Python

#2941 - python

HYEJU01 2024. 4. 20. 01:27
s = input() #๋ฌธ์ž์—ด๋ฐ›๊ธฐ
list =  ["c=", "c-", "dz=", "d-","lj", "nj", "s=", "z="]

for i in list :
    s = s.replace(i,"#") #ํ•ด๋‹น ๊ฐ’๋“ค์„ #์œผ๋กœ ์น˜ํ™˜์‹œ์ผœ์„œ 1๊ฐœ ๊ฐœ์ˆ˜๋กœ ์„ธ์–ด์ง€๋„๋กํ•œ๋‹ค.

print(len(s))

 

์ด ๋ฌธ์ œ์˜ ํ•ต์‹ฌ์€ ์น˜ํ™˜์ด๋‹ค !

c= dz= ๋“ฑ๋“ฑ ๋‘์ž๋ฆฌ ์„ธ์ž๋ฆฌ ๊ฐ’๋“ค์„ ๋น„๊ตํ•˜๊ธฐ์—” ๋ณต์žกํ•˜๋‹ค.

๊ทธ๋ž˜์„œ ํ•ด๋‹น ๊ฐ’๋“ค์„ ์ž„์˜์˜ ๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ๊ฒƒ์ด๋‹ค.  => #

๊ทธ๋Ÿด๊ฒฝ์šฐ ์ผ๋ฐ˜ ์•Œ๋ฐ”๋ฒณ๋“ค๊ณผ # ์„ len ์ฒ˜๋ฆฌํ•ด์„œ ์ถœ๋ ฅ๋งŒ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

 

 

  • ๐Ÿ’ฌ  replace() ํ•จ์ˆ˜๋Š” ๋ฌธ์ž์—ด์—์„œ ํŠน์ • ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์„ ๋‹ค๋ฅธ ๋ฌธ์ž์—ด๋กœ ์น˜ํ™˜  (์น˜ํ™˜๋œ ๊ฒฐ๊ณผ๋ฅผ ์ƒˆ๋กœ์šด ๋ณ€์ˆ˜์— ์ €์žฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์›๋ณธ ๋ฌธ์ž์—ด์€ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค) s.replace("apple", "pear")