#C14367. Filter Strings by Prefix
Filter Strings by Prefix
Filter Strings by Prefix
Given a list of strings and a target prefix, write a program that filters out all strings that do not start with the given prefix. The comparison should be case-insensitive, meaning that uppercase and lowercase letters are treated as equivalent.
The input is read from stdin and the result is printed to stdout. The first line of input contains an integer n which represents the number of strings. The following n lines each contain one string. The last line of input contains the target prefix. Your program should output the filtered strings in the same order as they appear in the input, each on a separate line. If no string matches the condition, output nothing.
Note: If the target prefix is an empty string, all input strings should be printed.
inputFormat
The first line contains an integer n indicating the number of strings.
The next n lines each contain a string.
The last line contains the target prefix. Note that the prefix can be empty.
outputFormat
Output the strings (each on a new line) from the original list that start with the target prefix (case-insensitive). The order of the strings should remain the same as in the input. If no string matches the condition, output nothing.
## sample4
hello
world
hi
house
h
hello
hi
house
</p>