Find the location of given sub string in a String

Get a String and Substring and find where the substring is present in String.

Sample Input 1:

entertainment ain

Sample Output 1:

6

Program or Solution

				
			
					
			
				
			

Program Explanation

check whether first character of sub string is equal to any character in string.

If it is equal, then check remaining characters are equal to the characters in substring.

else move to next character.


Tech Events

Hackathon