Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that’s why he decided to invent the function that will correct the words itself. Petya started from analyzing the case that happens to him most of the time, when all one needs is to delete one letter for the word to match a word from the dictionary. Thus, Petya faces one mini-task: he has a printed word and a word from the dictionary, and he should delete one letter from the first word to get the second one. And now the very non-trivial question that Petya faces is: which letter should he delete?
The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 10<sup class="upper-index">6</sup> symbols inclusive, the first string contains exactly 1 symbol more than the second one.
"""
https://vjudge.net/problem/CodeForces-39J

Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds
extra letters to the words. Of course, the spell-checking system underlines the words for him
and he has to click every word and choose the right variant. Petya got fed up with correcting
his mistakes himself, that’s why he decided to invent the function that will correct the words
itself.
Petya started from analyzing the case that happens to him most of the time, when all one needs
is to delete one letter for the word to match a word from the dictionary. Thus, Petya faces one
mini-task: he has a printed word and a word from the dictionary, and he should delete one letter
from the first word to get the second one. And now the very non-trivial question that Petya
faces is: which letter should he delete?

Input
The input data contains two strings, consisting of lower-case Latin letters.
The length of each string is from 1 to 10^6 symbols inclusive, the first string contains exactly
1 symbol more than the second one.

Output
In the first line output the number of positions of the symbols in the first string,
after the deleting of which the first string becomes identical to the second one.
In the second line output space-separated positions of these symbols in increasing order.
The positions are numbered starting from 1. If it is impossible to make the first string
identical to the second string by deleting one symbol, output one number 0.

==========================================================================================

An Ad Hoc Solution
Let’s think more carefully through an earlier example:

abcdxxxef
abcdxxef

Suppose that we remove the f from the first string (index 9). Does this
make the first string equal the second? No, so 9 will not show up in our
space-separated list of indices. The strings have a long prefix of matching
characters. There are six characters to be exact: abcdxx (prefix = 6). After that, the two
strings diverge, where the first string has an x and the second has an e. If we
don’t fix that, then we have no hope that the two strings will be equal. The f
is too far to the right for its deletion to produce equal strings.
That leads to our first observation: if the length of the longest common
prefix (in our example, six, the length of abcdxx) is p, then our only options
for deleting characters are those with indices of <= p + 1. In our example, we
should consider deleting a, b, c, d, the first x, the second x, and the third x.
Deleting anything to the right of p + 1 doesn’t fix the diverging character at
index p + 1 and hence can’t make the strings equal.
Notice that only some of these deletions actually work. For example,
deleting the a, b, c, or d from the first string does not give us the second
string. Only each of the three deletions of x gives us the second string. So,
while we’ve got an upper bound for indices to consider ( <= p + 1), we also need
a lower bound.
To think about a lower bound, consider removing the a from the first
string. Does that make the two strings equal? Nope. The reasoning is similar
to that in the previous paragraph: there are diverging characters to the right
of the as that can’t possibly be fixed by removing the as. If the length of the
longest common suffix (in our example, four, the length of xxef) is s, then we
should consider only indices that are >= n – s, where n is the length of the
first string. In our example, this tells us to consider only indices that are >= 5.
In the above paragraph, we argued that we should look at only indices that
are <+ 7. Together, we see that indices 5, 6, and 7 are the ones whose deletion
transforms the first string into the second.
In summary, the indices of interest go from n – s to p + 1. For any index
in this range, we know from p + 1 that the two strings are the same prior to
the index. We also know from n – s that the two strings are the same after the
index. Therefore, once we remove the index, the two strings are identical.
If the range is empty, then there are no indices whose deletion transforms
the first string into the second, so 0 is output in this case. Otherwise, we
use a for loop to loop through the indices and printf to produce the space separated
list. Let’s take a look at the code!

==========================================================================================
Sample 1
Input
abdrakadabra
abrakadabra

Output
1
3

Sample 2
Input
aa
a

Output
2
1 2

Sample 3
Input
competition
codeforces

Output
0

"""


def prefix_length(str1: str, str2: str) -> int:
    """
    Longest Common Prefix
    """
    i = 0
    for a, b in zip(str1, str2):
        if a == b:
            i += 1
    return i


def suffix_length(str1, str2):
    """
        Longest Common Suffix
    """
    i = 0
    for a, b in zip(reversed(str1), reversed(str2)):
        if a == b:
            i += 1
    return i


s1 = input()
s2 = input()
prefix = prefix_length(s1, s2)
suffix = suffix_length(s1, s2)
total = (prefix + 1) - (len(s1)+1 - suffix) + 1
if total < 0:
    total = 0
print(total)
for k in range(len(s1) - suffix, prefix+1):
    print(k, end=' ') if k <= prefix else print(k)
