occurences of character in string python

python program to get a String and a character then count the occurrence of character in the string.

Sample Input 1 :

Hello o

Sample Output 1 :

1

Program or Solution

				
			
					
s=input("Enter a String:")
c=input("Enter a Character:")
count=0
for i in range(0,len(s)):
    if(s[i]==c):
        count+=1
print(count)

			
				
			

Program Explanation

Visit each location in string s one by one for i in range(0,len(s)): if character c is found, increase the count by 1

Comments

ubaTaeCJ
-1 OR 2+181-181-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+181-181-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+181-181) --
ubaTaeCJ
-1 OR 3*2>(0+5+181-181) --
ubaTaeCJ
-1 OR 2+349-349-1=0+0+0+1
ubaTaeCJ
-1 OR 3+349-349-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+349-349)
ubaTaeCJ
-1 OR 3*2>(0+5+349-349)
ubaTaeCJ
-1' OR 2+119-119-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+119-119-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+119-119) --
ubaTaeCJ
-1' OR 3*2>(0+5+119-119) --
ubaTaeCJ
-1' OR 2+355-355-1=0+0+0+1 or 'q0i3cmuC'='
ubaTaeCJ
-1' OR 3+355-355-1=0+0+0+1 or 'q0i3cmuC'='
ubaTaeCJ
-1' OR 3*2<(0+5+355-355) or 'q0i3cmuC'='
ubaTaeCJ
-1' OR 3*2>(0+5+355-355) or 'q0i3cmuC'='
ubaTaeCJ
-1" OR 2+125-125-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+125-125-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+125-125) --
ubaTaeCJ
-1" OR 3*2>(0+5+125-125) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
DRNwDVXz'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 992=(SELECT 992 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 266=(SELECT 266 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 978=(SELECT 978 FROM PG_SLEEP(15))--
ubaTaeCJ
ozoFpm8v' OR 481=(SELECT 481 FROM PG_SLEEP(15))--
ubaTaeCJ
w0RaDnJ1') OR 633=(SELECT 633 FROM PG_SLEEP(15))--
ubaTaeCJ
wKWRHzk7')) OR 785=(SELECT 785 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@g2Kbf