Menu
Question Index
...


Write a program to create the letter count number of the given sentence.

Input (String) Output (Integer)
Dasaradh,Ram
Ram,Luv
Ram,Kush
Dasaradh,Lakshman
Dasaradh,Bharath
Dasaradh,Shatrugna

Dasaradh
+--Rama
|  +--Luv
|  +--Kush
+--Lakshman
+--Bharath
+--Shatrugna
A,B
B,C
C,D
D,E
B,F
C,K
D,X
A,M
A
+--B
|  +--C
|     +--D
|        +--E
|        +--X
|     +--K
|  +--F
+--M
A,AA
AA,AAB
AA,AAC
AAC,AAD
AAB,F23
F23,F45
A,BB
BB,L76
A,CC
A
+--AA
|  +--AAB
|     +--F23
|        +--F45
|  +--AAC
|     +--AAD
+--BB
|  +--L76
+--CC

class PrintFormattedFamilyHierarchy

{    public static void main(String s[])
    {
        String relations = "Dasaradh,Ram\n";
        relations += "Ram,Luv\n";
        relations += "Ram,Kush\n";
        relations += "Dasaradh,Lakshman\n";
        relations += "Dasaradh,Bharath\n";
        relations += "Dasaradh,Shatrugna\n";
        printFamilyHierarchy(relations);

    }


public static void printFamilyHierarchy(String familyHierarchy) {
//Write a code here to print the formatted family hierarchy as given in the question
}

//If needed create any additional methods here
}


Doubts

Problems

Topic: Java String Arrays - String Arrays In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App