[编程题]3
  • 热度指数:394 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解

给定英文句子S和字符串x,判断x是否为S中某些单词的前缀,若匹配到则输出第1个匹配单词的位置,否则输出-1

例如:输入"this is an easy problem.""eas",输出4

例如:输入"In love folly is always sweet""like",输出-1

例如:输入"Whatever is worth doing is worth doing well.""wor",输出3


示例1

输入

"this is an easy problem.","eas"

输出

4