# 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 of a ship and display the equivalent string class description of the given ID. Use the table below.

## Input Format

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

## Output Format

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

## Constraints

•  T  1000

Example

Sample Input

``````3
B
c
D
``````

Sample Output

``````BattleShip
Cruiser
Destroyer``````

## Solution – Id and Ship | CodeChef Solution

### C++

```#include <cctype>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace::std;
int main(int argc, const char * argv[]) {
int t;
cin >> t;
while (t--) {
char n;
cin >> n;
n = toupper(n);
switch (n) {
case 'B':
cout << "BattleShip" << endl;
break;
case 'C':
cout << "Cruiser" << endl;
break;
case 'D':
cout << "Destroyer" << endl;
break;
default:
cout << "Frigate" << endl;
break;
}
}
return 0;
}```

### Python

```#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")```

### Java

```import java.util.Scanner;
public class Main{

public static void main(String[] args) {
Scanner input =new Scanner(System.in);
int t=input.nextInt();
char ch;
while(t-->0)
{
ch=input.next().charAt(0);
if(ch=='B' || ch=='b')
System.out.println("BattleShip");
else if(ch=='C' || ch=='c')
System.out.println("Cruiser");
else if (ch=='D' || ch=='d')
System.out.println("Destroyer");
else if(ch=='F' || ch=='f')
System.out.println("Frigate");

}

}

}
```

Disclaimer: The above Problem (Id and Ship) is generated by CodeChef but the Solution is Provide by CodingBroz. This tutorial is only for Educational and Learning Purpose.