A WeChat media pipeline receives an elevation profile and a simplified validation pattern. Implement one function that solves both algorithmic tasks: calculate how much water the profile can trap, and determine whether the entire text matches the pattern.
The pattern supports only lowercase English letters, . matching any single character, and * matching zero or more occurrences of the preceding element.
Implement analyze_media(height, text, pattern):
height is a list of non-negative integers. Return the trapped water volume between the bars, where each bar has width 1.text and pattern are strings. Return whether the entire text matches pattern, not merely a substring.water, an integer, and matches, a boolean.* has a preceding valid pattern elementdef analyze_media(height, text, pattern):