@Override
	public int strstr(char[] pattern, char[] string) {
		if (pattern == null || string == null) {
			return -1;
		}

		int pat = 0;
		int start = 0;
		boolean isMatching = false;

		int index = -1;
		int cnt = 0;

		while (start < string.length) {
			if (pattern[pat] == string[start]) {
				if (!isMatching) {
					index = cnt;
					isMatching = true;
				}
				pat++;
			} else if (isMatching && pattern[pat] != string[start]) {
				pat = 0;
				start = index;
				index = -1;
			}

			if (pat == pattern.length)
				return index;

			start++;
			cnt++;
		}

		return index;
	}