#include <iostream>
using namespace std;

const int MAX_SIZE = 256;

bool substringOf(char[], char[]);
void inputString(char[], int);

int main() {

	char string[MAX_SIZE];
	inputString(string, MAX_SIZE);

	char secondString[MAX_SIZE];
	inputString(secondString, MAX_SIZE);

	bool isSubstring = substringOf(secondString, string);
	
	if(isSubstring) {
		cout << "It is a substring." << endl;
	} else {
		cout << "It is not a substring." << endl;
	}

	return 0;
}

void inputString(char string[], int limit) {

	cout << "Input a stirng (max" << limit << "): ";
	cin.getline(string, limit);

}

bool substringOf(char subs[], char str[], int start) {
	
	for(int i = 0, j = start; subs[i] != '\0'; ++i, ++j) {
		if(subs[i] != str[j]) {
			return false;
		}
	}
	return true;
}

bool substringOf(char subs[], char str[]) {

	for(int i = 0; str[i] != '\0'; ++i) {
		if(str[i] == subs[0] && substringOf(subs, str, i)) {
			return true;
		}
	}

	return false;	
}
