#314. 提取字符串夹心

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

提取字符串夹心

Sandwich Filling

Background

In daily life, we often encounter various string processing problems. Let's solve a string challenge related to 'sandwiches'.

Problem Description

A sandwich is two pieces of bread with something in between. Return the string that is between the first and last appearance of "bread" in the given string, or return the empty string "" if there are not two pieces of bread.

Input Format

The input consists of a single line, which is a string.

s

Output Format

The output consists of a single line, which is the extracted string.

result_string

Sample

breadjambread
"jam"
xxbreadjambreadyy
"jam"
xxbreadyy
""

Sample Explanation

In Sample 1 and Sample 2, the string "jam" is located between the first and last occurrences of "bread". In Sample 3, the string "bread" appears only once, which is less than twice, so an empty string is returned.

Constraints

Time limit: 1 second per test case. Memory limit: 1024 KiB per test case.