I am trying to write a function to scan in a string and find sets of the capital letter 'O'. Say my string is yyyOOOyyyOOyyyOyyy, it should print:
a group of 3 capital letter O's have been found together.
a group of 2 capital letter O's have been found together.
a group of 1 capital letter O's have been found together.
I cannot find a good way to do this. I'm trying to use nested loops, but I just don't have enough experience with it yet. Here is what I have come up with so far (I know it is completely non-functional). My code is also not allowing a user input using scanf (I have to use scanf for the assignment) Any help in correcting my loops and getting scanf to work would be great! Thanks!
void problem_03_function(){
char double_o_string[30];
scanf("%s", &double_o_string);
int count_double_o = 0;
char capital_letter_O = 'O';
int num_in_str = 0;
for(num_in_str; num_in_str < strlen(double_o_string); num_in_str++){
if(double_o_string[num_in_str] == capital_letter_O){
count_double_o++;
}
printf("a group of %d capital letter O's have been found togeth$
}
}