#317. 字符串模式匹配与修改
字符串模式匹配与修改
String Pattern Modification
Background
This problem involves processing a given string based on specific patterns.
Problem Description
Look for patterns like "zip" and "zap" in the string – these are length-3 substrings that start with 'z' and end with 'p'. Return a string where for all such words, the middle letter is removed. For example, "zipXzap" yields "zpXzp".
Input Format
Input is given from standard input in the following format.
s
Output Format
Output is printed to standard output in the following format.
modified_s
Sample
zipXzap
"zpXzp"
zopzop
"zpzp"
zzzopzop
"zzzpzp"
Sample Explanation
For the input "zipXzap\