View Code of Problem 3832

#include <iostream>
using namespace std;
int main(){
	string s,t;
	while(cin>>s>>t){
		int pos=-1;
		for(int i=0;i<s.length();i++){
			int j;
			for(j=0;j<t.length();j++){
				if(s[i+j]!=t[j])
					break;
			}
			if(j==t.length()){
				pos=i+1;
				break;
			}
		}
		cout<<pos<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3832