We need to write a program that for each test case, given a character (letterclass ID) outputs the corresponding ship class. The mapping: 'B' or 'b' -> "BattleShip"; 'C' or 'c' -> "Cruiser"; 'D' or 'd' -> "Destroyer"; 'F' or 'f' -> "Frigate". The problem statement says "Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID." Input: first line integer T, then T lines each containing a character. Output: for each test case, display the ship class.
Constraints: T up to 1000.
Simple solution: read T, then loop T times, read a character (maybe with whitespace handling), and use if-else or switch. Note that input may contain spaces? It says each line contains a character. So we can read as string and take first character. Or read char but careful about newline. In languages like C++, we can use cin to read char; it will skip whitespace? Actually, by default, cin >> char will skip leading whitespace, which includes newline. So after reading T, there's newline, then first character. So reading char with cin >> will work. In Python, just input().strip().
We need to output each on new line.
Edge cases: There may be other characters? According to problem, only B/b, C/c, D/d, F/f. So no invalid input.
Now code. Since this is a generic problem, we need to provide the code in a particular language? Usually, the problem is from CodeChef (I recall "Find the Ship" or "FLOW010"). But the problem statement doesn't specify language. So we'll produce a solution in Python, as it's simple.
Will output:
def main():
t = int(input())
for _ in range(t):
ch = input().strip().upper()
if ch == 'B':
print("BattleShip")
elif ch == 'C':
print("Cruiser")
elif ch == 'D':
print("Destroyer")
elif ch == 'F':
print("Frigate")
But note: The mapping is case-insensitive, so we can convert to uppercase. Or we can check both lower and upper.
Alternatively, dictionary: mapping = {'B':'BattleShip', 'b':'BattleShip', ...}. But we can convert to uppercase.
Now provide the solution.
Given the instruction "Write a program...", I'll output code in Python.
But also note: The problem is from some judge, typical solutions are in C, C++, Java, Python. I'll assume Python.
Thus final answer will be a Python program.
But the user might want a solution in a particular language? The prompt doesn't specify. Usually, in such Q&A tasks, we just provide a solution in a common language.
I'll produce a solution in Python 3.
Make sure to handle possible extra whitespace: use strip().
Edge: if input is like " b" with space? But it says each line contains a character. So strip is safe.
Now produce the final answer. ```python
def main():
t = int(input()) # number of test cases
for _ in range(t):
# read a character, strip whitespace, and convert to uppercase
ch = input().strip().upper()
if ch == 'B':
print("BattleShip")
elif ch == 'C':
print("Cruiser")
elif ch == 'D':
print("Destroyer")
elif ch == 'F':
print("Frigate")
# according to the problem the input is always one of these four
if name == "main":
main()