Https://hack.codingblocks.com/contests/c/456/345

question++https://hack.codingblocks.com/contests/c/456/345

Answer == https://ide.codingblocks.com/#/s/17190

shivam the link of question is not opening can u describe the question

Take as input str, a string

a.) Write a recursive function which counts, the number of times “aaa” appears in the string. Print the value returned.

b.) Write a recursive function which counts, the number of times “aaa” appears in the string, but only such instances of “aaa” should be considered which do not overlap. Print the value returned.

Heyy shivam ! ur code is not working for the inputs having greater than 5 consecutive ‘a’ s . because your toggle count will give you answer 0 even if you have aaa. Example :
aaaaaa
Here you have counted 1 aaa and you made toggle = 1, the you are traversing the string but suppose if you have reached the position 4 then you still have toggle equal to 1 but your beg variable is a your if statements will not be satisfied so you skiped the current aaa and moved further . Hope you getting this .
Here i modified your code , take a look on this ;->
https://ide.codingblocks.com/#/s/17850

ohhh thanks :+1: :+1: :+1: