#K40082. Filtered Products

    ID: 26563 Type: Default 1000ms 256MiB

Filtered Products

Filtered Products

You are given a list of product codes and two parameters: a category character and a sub-category minimum threshold. Each product code starts with a letter (the category) followed by a numeric part. Your task is to filter out the products that belong to the given category and whose numeric value is greater than or equal to the threshold.

Formally, if a product code is represented as \( cN \) where \( c \) is the category character and \( N \) is the numeric part (interpreted as an integer), you must output all products such that \( c = \text{given_category} \) and \( N \geq \text{threshold} \). The order of the products in the output must be the same as they appear in the input.

For example, consider the product list: ["A1234", "B5678", "A4321", "C9999", "A1111", "B3333"] with the given category "A" and the threshold \(1500\). Only "A4321" satisfies \(4321 \geq 1500\) while maintaining the category condition.

inputFormat

The input is provided via standard input (stdin) in the following format:

  • The first line contains an integer \( n \) representing the number of products.
  • The next \( n \) lines each contain a product code (a string).
  • The following line contains a single character denoting the target category.
  • The last line contains an integer representing the sub-category minimum threshold.

Note: When \( n = 0 \), there will be no product lines.

outputFormat

Output a single line to standard output (stdout) containing the filtered product codes separated by a space. If no product satisfies the criteria, output an empty line.

## sample
6
A1234
B5678
A4321
C9999
A1111
B3333
A
1500
A4321

</p>