#include <bits/stdc++.h>
#include <ext/hash_map>
using namespace std;
using namespace __gnu_cxx;
#define oo 1e9
#define ll long long
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define lop(i,n) for(int i=0;i<n;++i)
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define pi acos(-1)
/////// Suffix array //////////////
/// O(NlogN) implementation ////
const int MX= 200100 ,alphabetSize= 128 ;
char str[ MX] ;
int n;
int rnk[ MX] ,newRnk[ MX] ,rnkSt[ MX] ,suf[ MX] ,newSuf[ MX] ;
int head[ alphabetSize] ,nxt[ MX] ,lcp[ MX] ;
void buildSA( ) {
memset ( head,- 1 ,sizeof head) ;
for ( n= 0 ; ! n|| str[ n- 1 ] ; ++ n) {
nxt[ n] = head[ ( int ) str[ n] ] ;
head[ ( int ) str[ n] ] = n;
}
int ns= 0 ,ng= 0 ; // next start - next group
for ( int i= 0 ; i< alphabetSize; i++ ) {
if ( head[ i] == - 1 ) continue ;
rnkSt[ ng] = ns;
for ( int j= head[ i] ; j! = - 1 ; j= nxt[ j] ) {
suf[ ns++ ] = j;
rnk[ j] = ng;
}
ng++ ;
}
newSuf[ 0 ] = suf[ 0 ] ;
ng= 0 ;
for ( int len= 1 ; ng! = n- 1 ; len<<= 1 ) {
for ( int i= 0 ; i< n; i++ ) {
int j= suf[ i] - len;
if ( j< 0 ) continue ;
newSuf[ rnkSt[ rnk[ j] ] ++ ] = j;
}
ng= 0 ;
for ( int i= 1 ; i< n; i++ ) {
ng+ = ( rnk[ newSuf[ i- 1 ] ] < rnk[ newSuf[ i] ]
|| ( rnk[ newSuf[ i- 1 ] ] == rnk[ newSuf[ i] ]
&& rnk[ newSuf[ i- 1 ] + len] < rnk[ newSuf[ i] + len] ) ) ;
newRnk[ i] = ng;
if ( newRnk[ i] ! = newRnk[ i- 1 ] ) rnkSt[ ng] = i;
}
for ( int i= 0 ; i< n; i++ ) {
suf[ i] = newSuf[ i] ;
rnk[ suf[ i] ] = newRnk[ i] ;
}
}
}
void buildLCP( ) {
int cnt= 0 ;
for ( int i= 0 ; i< n- 1 ; i++ ) {
int j= suf[ rnk[ i] - 1 ] ;
while ( str[ i+ cnt] == str[ j+ cnt] ) cnt++ ;
lcp[ rnk[ i] ] = cnt;
if ( cnt) cnt-- ;
}
}
char note[ 40202 ] ;
char str2[ MX] ;
string tmp,tmp2;
vector< string> ans;
void solve( ) {
int idx= 0 ;
while ( note[ idx] ) {
while ( note[ idx] && note[ idx] == ' ' ) idx++ ;
if ( ! note[ idx] ) break ;
int l= 0 ,r= n- 1 ;
int nw= idx;
while ( note[ nw] >= str[ suf[ l] + nw- idx] && note[ nw] <= str[ suf[ r] + nw- idx] ) {
int l1= l,r1= r,mid;
while ( l1< r1) {
mid= l1+ ( r1- l1) / 2 ;
if ( str[ suf[ mid] + nw- idx] >= note[ nw] ) r1= mid;
else l1= mid+ 1 ;
}
l= l1;
l1= l,r1= r;
while ( l1< r1) {
mid= l1+ ( r1- l1+ 1 ) / 2 ;
if ( str[ suf[ mid] + nw- idx] <= note[ nw] ) l1= mid;
else r1= mid- 1 ;
}
r= l1;
if ( note[ nw] == str[ suf[ l] + nw- idx] || note[ nw] == str[ suf[ r] + nw- idx] )
nw++ ;
else break ;
}
nw-- ;
tmp= "" ;
int s= suf[ l] ,e= suf[ l] + nw- idx;
for ( int i= s; i<= e; i++ )
tmp+ = str2[ i] ;
while ( tmp[ sz( tmp) - 1 ] == ' ' )
tmp.erase ( tmp.begin ( ) + sz( tmp) - 1 ) ;
ans.push_back ( tmp) ;
idx= nw+ 1 ;
}
}
int main( ) {
#ifndef ONLINE_JUDGE
freopen ( "input.txt" , "rt" , stdin ) ;
//freopen("output.txt", "wt", stdout);
#endif
getline( cin ,tmp) ;
for ( int i= 0 ; i< sz( tmp) ; i++ ) note[ i] = tmp[ i] ;
note[ sz( tmp) ] = '\0 ' ;
while ( getline( cin ,tmp) ) tmp2+ = tmp;
for ( int i= 0 ; i< sz( tmp2) ; i++ ) {
str2[ i] = tmp2[ i] ;
str[ i] = tolower ( tmp2[ i] ) ;
}
str2[ sz( tmp2) ] = '\0 ' ;
str[ sz( tmp2) ] = '\0 ' ;
buildSA( ) ;
solve( ) ;
cout << sz( ans) << endl;
for ( int i= 0 ; i< sz( ans) ; i++ )
cout << ans[ i] << endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvaGFzaF9tYXA+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9jeHg7CgojZGVmaW5lIG9vICAgICAgIDFlOQojZGVmaW5lIGxsICAgICAgIGxvbmcgbG9uZwojZGVmaW5lIHNjKHgpICAgIHNjYW5mKCIlZCIsJngpCiNkZWZpbmUgc2NsKHgpICAgc2NhbmYoIiVsbGQiLCZ4KQojZGVmaW5lIGxvcChpLG4pIGZvcihpbnQgaT0wO2k8bjsrK2kpCiNkZWZpbmUgc3ooeCkgICAgKGludCl4LnNpemUoKQojZGVmaW5lIGFsbCh4KSAgIHguYmVnaW4oKSx4LmVuZCgpCiNkZWZpbmUgRiAgICAgICAgZmlyc3QKI2RlZmluZSBTICAgICAgICBzZWNvbmQKI2RlZmluZSBwaSAgICAgICBhY29zKC0xKQoKLy8vLy8vLyBTdWZmaXggYXJyYXkgLy8vLy8vLy8vLy8vLy8KLy8vICBPKE5sb2dOKSBpbXBsZW1lbnRhdGlvbiAgLy8vLwpjb25zdCBpbnQgTVg9MjAwMTAwLGFscGhhYmV0U2l6ZT0xMjg7CgpjaGFyIHN0cltNWF07CmludCBuOwppbnQgcm5rW01YXSxuZXdSbmtbTVhdLHJua1N0W01YXSxzdWZbTVhdLG5ld1N1ZltNWF07CmludCBoZWFkW2FscGhhYmV0U2l6ZV0sbnh0W01YXSxsY3BbTVhdOwoKdm9pZCBidWlsZFNBKCl7CiAgbWVtc2V0KGhlYWQsLTEsc2l6ZW9mIGhlYWQpOwogIGZvcihuPTA7IW58fHN0cltuLTFdOysrbil7CiAgICBueHRbbl09aGVhZFsoaW50KXN0cltuXV07CiAgICBoZWFkWyhpbnQpc3RyW25dXT1uOwogIH0KICBpbnQgbnM9MCxuZz0wOyAgLy8gbmV4dCBzdGFydCAtIG5leHQgZ3JvdXAKICBmb3IoaW50IGk9MDtpPGFscGhhYmV0U2l6ZTtpKyspewogICAgaWYoaGVhZFtpXT09LTEpY29udGludWU7CiAgICBybmtTdFtuZ109bnM7CiAgICBmb3IoaW50IGo9aGVhZFtpXTtqIT0tMTtqPW54dFtqXSl7CiAgICAgIHN1ZltucysrXT1qOwogICAgICBybmtbal09bmc7CiAgICB9CiAgICBuZysrOwogIH0KICBuZXdTdWZbMF09c3VmWzBdOwogIG5nPTA7CiAgZm9yKGludCBsZW49MTtuZyE9bi0xO2xlbjw8PTEpewogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgIGludCBqPXN1ZltpXS1sZW47CiAgICAgIGlmKGo8MCljb250aW51ZTsKICAgICAgbmV3U3VmW3Jua1N0W3Jua1tqXV0rK109ajsKICAgIH0KICAgIG5nPTA7CiAgICBmb3IoaW50IGk9MTtpPG47aSsrKXsKICAgICAgbmcrPShybmtbbmV3U3VmW2ktMV1dPHJua1tuZXdTdWZbaV1dCiAgICAgICAgICB8fChybmtbbmV3U3VmW2ktMV1dPT1ybmtbbmV3U3VmW2ldXQogICAgICAgICAgJiZybmtbbmV3U3VmW2ktMV0rbGVuXTxybmtbbmV3U3VmW2ldK2xlbl0pKTsKICAgICAgbmV3Um5rW2ldPW5nOwogICAgICBpZihuZXdSbmtbaV0hPW5ld1Jua1tpLTFdKXJua1N0W25nXT1pOwogICAgfQogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgIHN1ZltpXT1uZXdTdWZbaV07CiAgICAgIHJua1tzdWZbaV1dPW5ld1Jua1tpXTsKICAgIH0KICB9Cn0KCnZvaWQgYnVpbGRMQ1AoKXsKICBpbnQgY250PTA7CiAgZm9yKGludCBpPTA7aTxuLTE7aSsrKXsKICAgIGludCBqPXN1ZltybmtbaV0tMV07CiAgICB3aGlsZShzdHJbaStjbnRdPT1zdHJbaitjbnRdKWNudCsrOwogICAgbGNwW3Jua1tpXV09Y250OwogICAgaWYoY250KWNudC0tOwogIH0KfQoKY2hhciBub3RlWzQwMjAyXTsKY2hhciBzdHIyW01YXTsKc3RyaW5nIHRtcCx0bXAyOwoKdmVjdG9yPHN0cmluZz4gYW5zOwoKdm9pZCBzb2x2ZSgpewogIGludCBpZHg9MDsKICB3aGlsZShub3RlW2lkeF0pewogICAgd2hpbGUobm90ZVtpZHhdJiZub3RlW2lkeF09PScgJylpZHgrKzsKICAgIGlmKCFub3RlW2lkeF0pYnJlYWs7CiAgICBpbnQgbD0wLHI9bi0xOwogICAgaW50IG53PWlkeDsKICAgIHdoaWxlKG5vdGVbbnddPj1zdHJbc3VmW2xdK253LWlkeF0mJm5vdGVbbnddPD1zdHJbc3VmW3JdK253LWlkeF0pewogICAgICBpbnQgbDE9bCxyMT1yLG1pZDsKICAgICAgd2hpbGUobDE8cjEpewogICAgICAgIG1pZD1sMSsocjEtbDEpLzI7CiAgICAgICAgaWYoc3RyW3N1ZlttaWRdK253LWlkeF0+PW5vdGVbbnddKXIxPW1pZDsKICAgICAgICBlbHNlIGwxPW1pZCsxOwogICAgICB9CiAgICAgIGw9bDE7CiAgICAgIGwxPWwscjE9cjsKICAgICAgd2hpbGUobDE8cjEpewogICAgICAgIG1pZD1sMSsocjEtbDErMSkvMjsKICAgICAgICBpZihzdHJbc3VmW21pZF0rbnctaWR4XTw9bm90ZVtud10pbDE9bWlkOwogICAgICAgIGVsc2UgcjE9bWlkLTE7CiAgICAgIH0KICAgICAgcj1sMTsKICAgICAgaWYobm90ZVtud109PXN0cltzdWZbbF0rbnctaWR4XXx8bm90ZVtud109PXN0cltzdWZbcl0rbnctaWR4XSkKICAgICAgICBudysrOwogICAgICBlbHNlIGJyZWFrOwogICAgfQogICAgbnctLTsKICAgIHRt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GUgcHJpbWFyeSBnb2FsIHdhcyB0byBzdHVkeSBvbmUgcGFydGljdWxhciBzb2Z0d2FyZSBzeXN0ZW0uCkFzIGEgcmVzdWx0LCBzb21lIHN0ZXBzIHRoYXQgYXJlIG9ubHkgZG9uZSBvbmNlIChzdWNoIGFzIGV4dHJhY3RpbmcKaW5mb3JtYXRpb24gZnJvbSB0aGUgcHJvZ3JhbSB1bmRlciBzdHVkeSkgYXJlIGRvbmUgdXNpbmcgY3VtYmVyc29tZQphZC1ob2MgdGVjaG5pcXVlcyB0aGF0IHJlcXVpcmUgc2lnbmlmaWNhbnQgbWFudWFsIGludGVydmVudGlvbi4gV2hpbGUKJnF1b3Q7cmFpbiZxdW90OyBjYW4gYmUgdXNlZCBvbiBhcmJpdHJhcnkgcHJvZ3JhbXMsIG1vcmUgZGV2ZWxvcG1lbnQgd29yayBuZWVkcwp0byBiZSBkb25lIGJlZm9yZSB0aGlzIGlzIGEgY29udmVuaWVudCBwcm9jZXNzLgo=
drop the price on new thermopanes now or else
Rain Users Guide
While "rain" was intended to be a general purpose tool, at the time of
writing the primary goal was to study one particular software system.
As a result, some steps that are only done once (such as extracting
information from the program under study) are done using cumbersome
ad-hoc techniques that require significant manual intervention. While
"rain" can be used on arbitrary programs, more development work needs
to be done before this is a convenient process.