#295. 字符串前缀匹配(首字符可不同)

    ID: 295 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatString-1gesp3字符串

字符串前缀匹配(首字符可不同)

Prefix Match with Flexible First Character

Background

Congcong is currently learning about string processing and has encountered an interesting problem that requires your help to solve.

Problem Description

Given a main string SS and a "word" string WW, we'll say that WW matches SS if it appears at the front of SS, except its first character does not need to match exactly. On a match, return the front of SS (with the same length as WW), or otherwise return the empty string. The word WW will be at least length 11.

For example, with the string $S = ext{"hippo\