C++๊ณผ ์•ฝ๊ฐ„์˜ ์ฐจ์ด๋ฅผ ๊ธฐ์–ตํ•ด์•ผ ํ•˜๋Š”๋ฐ, ๊ฐ€์žฅ ํ•ต์‹ฌ์ ์ธ ๊ฒƒ์€ OR, AND ๋ฅผ ๊ทธ๋Œ€๋กœ ๊ฐ–๋‹ค ์“ด๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. C++์—์„œ๋Š” ๊ฐ๊ฐ && , || ๋กœ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ, ์ด๊ฒƒ์„ AND, OR ๋กœ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

๋ฌธ์ž์—ด์—์„œ ํŠน์ • ๋ฌธ์ž ๊ฐฏ์ˆ˜ ์„ธ๋Š” ํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœํ•˜๊ธฐ

def calcCharacterFromString(sentence, inputChar):
    numChs = sentence.count(inputChar)
    return numChs
 
sentence = 'Mary had a little lamb'
inputChar = input("Enter the Char : ")
 
calcCharacterFromString(sentence, inputChar)