Write a program find the number of occurrences of a character in a given string. Input: First line is the string, s Second line is the character, c Output: An integer, i.e. the number of occurrences of c in s. Test Case 1 Input (stdin) welcome w Expected Output 1 Test Case 2 Input (stdin) tamilnadu a Expected Output 2
def count(s, c) :
res = 0
for i in range(len(s)) :
if (s[i] == c):
res = res + 1
return res
str=input()
c = input()
print(count(str, c))