#T470. 字符串出现位置
字符串出现位置
Description
Given two strings, a main string and a substring, please find the first occurrence of the substring in the main string. If the substring does not appear in the main string, output -1. For example, the substring "ab" first appears at position 3 in the main string "dceab", while the substring "abc" does not appear in "dceab".
Input Format
The first line contains a string (the main string), guaranteed to consist of lowercase letters only. The second line contains a string (the substring), also guaranteed to consist of lowercase letters only. Both strings are guaranteed to have lengths not exceeding 10,000 and greater than 0.
Output Format
A single integer representing the position of the first occurrence of the substring in the main string. If the substring does not appear in the main string, output -1.
CodesOnline