Question
A scientific research team is trying to study asteroids sizes in the space to assess the impact of collision on earth. It is not possible
A scientific research team is trying to study asteroids sizes in the space to assess the impact of collision on earth. It is not possible size of the asteroid. Hence, they provided the relation of one asteroid size with another one. Given the relative size comparisons in equation, your task is to come up with a program which generates an output with relationship with all the asteroids found. Arrange size in descending order. Develop a program to help the research team convert the input specification to standardized output specification. Your program is the relations data as input and produce an output as per corresponding output specification as output. Please note: Custom input option is not available for this question
Sample Input# 1: A,C,D,E E=5 A C=2 D D=100 E
output #1
1C=2D=200E,1000=A
Sample Input 1
Ax,D-I,C-II,B
C-II=3 Ax
D-I=2 B
C-II=2 D-I
Sample output 1
1C-II=2D-I=3Ax=4B
Explanation
Input
There are two kinds of inputs to the explanation
1. Name of asteroids separated by comma
2. Set of expressions defining the relationships between two asteroids size. Each relationship is entered in separate line Each expression contains name of asteroid with equal sign expression no. of units separated by space asteroid.
Note: The number of expressions given will be no less than n-1, where in, n is the number of asteroids.
Output
The output shall be one line. that compare relationship between asteroid sizes and ordered in descending size
Note: Your code must be able to print the sample output from provided sample input However, your code is run against multiple hidden test case therefore your code must pass these hidden test cases to solve the problem statement
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started