Skim a long paragraph and you can build the phrase "welcome to code jam" out of it: find a 'w', then find an 'e' later on, then an 'l' after that, and so on. The same paragraph gives many different ways to do it, depending on which letters you pick.
Given one line of text, count how many ways "welcome to code jam" appears in it as a subsequence. Formally, let S be the input string and let T = "welcome to code jam". Count the index sequences s with s[0]<s[1]<⋯<s[18] such that concatenating S[s[0]],S[s[1]],…,S[s[18]] gives T. The length of T is 19 including its spaces, and each space of T must also be matched by a space of the input.
The count can be huge, so report only its last four digits.