Write a program that takes two strings as input and checks how many times the second one is repeated in the first one. The program should first output the position of each repeat
and then the number of repeats.
- The strings are already being read in the provided code. You shouldn't read the first or the second string again.
- Note that the program should output the position for each repeat, not array index. If you look at the third example, the second string "the" is at the begining of the first string. But
the output is 1 for that repeat, not 0.
- You can assume the maximum length of strings are 50.
- You can assume the first string is longer than the second one.
Examples:
how much wood would a woodchuck chuck? wood |
10 23 2 |
no repeats on this one stuff |
0 |
there is the other thing the |
1 10 15 3 |
Important issues about all exams/projects/quizzes:
- Update just Question.c file, not Question.txt.
- Make changes only between the following comments(DO NOT modify these comments or anything outside the region marked by the comments):
- // DO_NOT_EDIT_ANYTHING_ABOVE_THIS_LINE
- // DO_NOT_EDIT_ANYTHING_BELOW_THIS_LINE
- If you modify these comments for any reason, you can copy/paste the initial version from Question.txt into Question.c. Note that Question.txt is not graded at all, so anything you write in Question.txt will be discarded.
- To avoid getting the 'Binary Not Found' error, SAVE and BUILD your code before RUN.
- Do not add any extra messages message for input/output such as 'Enter an integer:', 'The result is:', etc. Any additional text that appears in the output will cause you to get no points from the question.
- Input and output of your program must be just like those in the Examples table above.