class UserMainCode(object):
@classmethod
def getPattern(cls, input1, input2):
# Create a dictionary to store the counts of characters in the pattern
pattern_dict = {}
for char in input2:
pattern_dict[char.lower()] = pattern_dict.get(char.lower(), 0) + 1
# Initialize variables
start = 0
min_length = float('inf')
min_substring = ""
unique_chars_covered = 0
current_substring = {}
for end in range(len(input1)):
char = input1[end].lower()
if char in pattern_dict:
current_substring[char] = current_substring.get(char, 0) + 1
if current_substring[char] == pattern_dict[char]:
unique_chars_covered += 1
while unique_chars_covered == len(pattern_dict):
if end - start + 1 < min_length:
min_length = end - start + 1
min_substring = input1[start:end + 1]
char = input1[start].lower()
if char in pattern_dict:
current_substring[char] -= 1
if current_substring[char] < pattern_dict[char]:
unique_chars_covered -= 1
start += 1
return min_substring