When we were kids, we used to play with some stickers where these stickers contain some (but not
necessarily all) lower case English alphabet letters.
Each sticker contains some letters arranged in a single row, where all occurrences of the same letter are
adjacent to each other. A sticker can be represented as a string of characters, for example the following
are valid stickers' representations: aabcc, ccccab and mmaw. And the following are not valid (because
not all occurrences of the same letter are adjacent to each other): abacc, cccabc and mawm.
Now we found some stickers with some missing letters, but we are sure that all missing letters belong to
the visible letters set (that is, for every missing letter, there is at least one visible letter that matches
the missing one). In this problem a question mark letter represents a missing letter. Given some stickers'
representations with zero or more missing letters, your task is to count the number of possible original
congurations for each sticker.
For example, this sticker aa??bb with missing letters could have been one of the following original stickers
aaaabb, aaabbb or aabbbb. But it could not have been any of the following original stickers aababb
(it is invalid sticker) and aaccbb (because the letter `c' did not appear in the given conguration).