//kmp
int IndexOfSubstr(const char* const raw_str, const char* const sub_str)
{
	int sublength = 0;
	for (int i = 0; sub_str[i] != '\0'; i++)
	{
		sublength++;
	}
	vector<int> next(sublength, 0);
	int i = 1;
	int j = 0;
	while (sub_str[i] != '\0')
	{
		if (sub_str[i] == sub_str[j])
		{
			next[i] = j + 1;
			i++;
			j++;
		}
		else
		{
			if (j != 0)
			{
				j = next[j - 1];
			}
			else
			{
				next[i] = 0;
				i++;
			}
		}
	}
	i = 0;
	j = 0;
	while (sub_str[j] != '\0'&&raw_str[i] != '0')
	{
		if (sub_str[j] == raw_str[i])
		{
			j++;
			i++;
		}
		else
		{
			if (j != 0)
				j = next[j - 1];
			else
				i++;
		}
	}
	if (sub_str[j] == '\0')
	{
		return i - j;
	}
	else
		return -1;
}