Hide

Problem A
Count Occurrences

Write a program that, given a string $s$ and a character $c$, prints out the indicies of where $c$ appears in $s$.
Note that the program must be case sensitive. For example, M appears in the string Mississippi, but m does not.

All characters in the input and output are either a letter in the English alphabet, digit, space or punctuation.

Input

Input consists of two lines.
The first line contains the string $s$. The length of $s$ is at most $10^6$. The second line contains the character $c$.

Output

The output should consist of $l$ lines, where $l$ is the number of times $c$ appears in $s$.
The $i$-th line of the output should contain the index of the $i$-th match.

Sample Input 1 Sample Output 1
my dogs name is mary
m
0
10
16
Sample Input 2 Sample Output 2
Mississippi is in the Southeastern region of the United States.
s
2
3
5
6
13
29
61

Please log in to submit a solution to this problem

Log in