// 7915734 vrs570540852 3753 accepted 368 K 0 Ms GCC 1169b 18:36:18
// Poj question a of the first top embedded Cup Finals of 3753
# Include <stdio. h>
# Include <string. h>
# Define null 0
Int safestrcpy2keyword (char * pdestbuffer,
Const char * psourcestring,
Int ndestbuffersize,
Char * szkeyword)
{
If (pdestbuffer = NULL | psourcestring = NULL)
Return 0;
Char * sourcesta = (char *) psourcestring;
Char * keysta = szkeyword;
Char * deststa = pdestbuffer;
Int COUNT = 0;
Int keylen;
If (keysta = 0)
Keylen = 0;
Else
Keylen = strlen (keysta );
While (* sourcesta! = '\ 0' & count <= ndestbuffersize)
{
If (count + keylen <= ndestbuffersize & keylen! = 0 &&! Strncmp (sourcesta, keysta, keylen ))
Return count;
* Deststa ++ = * sourcesta ++;
Count ++;
}
Return count;
}
Int main ()
{
Char ptrdest [300] = {0 };
Char ptrsource [300] = {0 };
Char key [20] = {0 };
Int count;
While (scanf ("% s", & ptrsource )! = EOF)
{
While (scanf ("% s", & Key) & strcmp (key, "end \ 0 "))
{
Memset (ptrdest, 0, sizeof (ptrdest ));
If (! Strcmp (key, "null \ 0 "))
{
Printf ("0 null \ n ");
Continue;
}
Count = safestrcpy2keyword (ptrdest, ptrsource, 260, key );
If (COUNT = 0)
Printf ("0 null \ n ");
Else
Printf ("% d % s \ n", Count, ptrdest );
}
}
Return 0;
}