Id and Ship - CodeChef Solution

Hello coders, today we are going to solve Id and Ship CodeChef Solution whose Problem code is FLOW010. Write a program that takes in a letterclass ID

Hello coders, today we are going to solve Id and Ship CodeChef Solution whose Problem code is FLOW010.

Id and Ship - CodeChef Solution

Problem

Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below.

Class ID Ship Class

B or b BattleShip

C or c Cruiser

D or d Destroyer

F or f Frigate

Input

The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains a character.

Output

For each test case, display the Ship Class depending on ID, in a new line.

Constraints

  • 1 <= T <= 1000

Example

Input:

3 
B
c
D

Output:

BattleShip
Cruiser
Destroyer

Solution - Id and Ship - CodeChef Solution 

Python 3 

#Solution Provided by Sloth Coders
T = int(input())
for i in range(T):
    n = input()
    if (n =="B" or n == "b"):
        print("BattleShip")
    elif (n == "C" or n == "c"):
        print("Cruiser")
    elif (n == "D" or n == "d"):
        print("Destroyer")
    else:
        print("Frigate")

Disclaimer: The above Problem (Id and Ship) is generated by CodeChef but the Solution is provided by Sloth Coders.

Also Read:

Sloth Coders is a Learning Platform for Coders, Programmers and Developers to learn from the basics to advance of Coding of different langauges(python, Java, Javascript and many more).

Post a Comment