Algorithm


  problem Link :  https://www.codechef.com/problems/FLOW010

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 IDShip Class
B or bBattleShip
C or cCruiser
D or dDestroyer
F or fFrigate

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
  • Sample 1:

    Input
    Output
    3 
    B
    c
    D
    
    BattleShip
    Cruiser
    Destroyer
    


    Code Examples

    #1 Code Example with C Programming

    Code - C Programming

    #include<stdio.h>
    int main()
    {
        int n,i;
        char ch;
        scanf("%d",&n);
        for(i=1;i < =n;i++)
        {
            scanf(" %c",&ch);
            if(ch=='B' || ch=='b') printf("BattleShip\n");
            else if(ch=='C' || ch== 'c') printf("Cruiser\n");
            else if(ch=='D' || ch== 'd') printf("Destroyer\n");
            else if(ch=='F' || ch== 'f') printf("Frigate\n");
        }
    } 
    Copy The Code & Try With Live Editor

    Input

    x
    +
    cmd
    3
    B
    c
    D

    Output

    x
    +
    cmd
    BattleShip
    Cruiser
    Destroyer
    Advertisements

    Demonstration


    CodeChef solution FLOW010  - ID and Ship  Codechef solution in C,C++





    Previous
    #68 Leetcode Text Justification Solution in C, C++, Java, JavaScript, Python, C# Leetcode
    Next
    #70 Leetcode Climbing Stairs Solution in C, C++, Java, JavaScript, Python, C# Leetcode