Hello Programmers In this post, you will know how to solve the Id and Ship Codechef Solution.Id and Ship Codechef SolutionOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.ProblemWrite a program that takes in a letter class ID of a ship and display the equivalent string class description of the given ID. Use the table below.Class ID Ship ClassB or b BattleShipC or c CruiserD or d DestroyerF or f FrigateInputThe first line contains an integer T, the total number of testcases. Then T lines follow, each line contains a character.OutputFor each test case, display the Ship Class depending on ID, in a new line.Constraints1 <= T <= 1000ExampleInput:3 B c D Output:BattleShip Cruiser DestroyerId and Ship CodeChef Solutions in PythonT = 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")Id and Ship CodeChef Solutions in CPP#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; }Id and Ship CodeChef Solutions in JAVAimport 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 provided by BrokenProgrammers. This tutorial is only for Educational and Learning purpose.Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.Next: GCD and LCM Codechef Solution Post navigationThe Block Game Codechef Solution GCD and LCM Codechef Solution