#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define MAX 1000
char getline(char line[], int limit)//读写
{
	int ch = 0;
	int i = 0;
	while (((ch = getchar()) != '\n') && (ch != EOF) && (--limit))
	{
		line[i++] = ch;
	}
	if (ch == '\n')
		line[i++] = ch;
	line[i] = '\0';
	return i;
}
char* my_strstr(char * line, char *p)
{
	assert(line);
	assert(p);
	//int len1 = strlen(line);
	//int len2 = strlen(p);
	//if (len1 < len2)
	//return NULL;
	/*while (*line)
	{
		int i = 0;
		while (1)
		{
			if (p[i] == '\0')
				return line;
			if (p[i] != line[i])
				break;
			i++;
		}
		line++;
	}
	return NULL;*/
	int i = 0;
	int j = 0;
	while (line[i])
	{
		if (line[i] == p[j])
		{
			i++;
			j++;
		}
		else
		{
			i = i - j + 1;
			j = 0;
		}
		if (p[j] == '\0')
			break;
	}
}
int main()
{
	char line[MAX];
	char *p = "ould";
	getline(line,MAX);
	my_strstr(line, p);
	while (getline(line, MAX)>0)
	{
		if (my_strstr(line, p) != NULL)
		{
			printf("%s", line);
		}
	}
	system("pause");
	return 0;
}