samedi 9 janvier 2021

CODE MUST BE IN JAVA OR C++ Asteroid Size Estimator [closed]

CODE MUST BE IN JAVA OR C++

Asteroid Size Estimator

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

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

Aucun commentaire:

Enregistrer un commentaire