Input:

Pattern:

Result: