#K86777. PokeScan Battle Simulation
PokeScan Battle Simulation
PokeScan Battle Simulation
In this problem, you are required to simulate a battle between two Pokémon-like entities called PokeScans. Each PokeScan is defined by a name, a level, and a type. The rules for determining the outcome of the battle are as follows:
- If the levels are different, the PokeScan with the higher level wins.
- If the levels are equal, the winner is determined by type advantage according to the rule: [ \text{water} > \text{fire}, \quad \text{fire} > \text{grass}, \quad \text{grass} > \text{water} ] That is, water beats fire, fire beats grass, and grass beats water.
- If the levels are equal and neither type has the advantage (including cases where both types are the same or not part of the advantage rule), the battle results in a tie.
Your task is to read the details of two PokeScans from the standard input and print the result of the battle. The output should be a single line indicating the result in one of the following formats:
- "X wins against Y!" if either X or Y wins.
- "It's a tie between X and Y!" if the battle is a tie.
Make sure to follow the input and output specifications strictly.
inputFormat
The input consists of two lines. Each line contains three values separated by spaces:
- The first value is a string representing the PokeScan's name.
- The second value is an integer representing the PokeScan's level.
- The third value is a string representing the PokeScan's type (e.g. water, fire, grass, electric, etc.).
For example:
Pikachu 25 electric Charmander 20 fire
outputFormat
The output is a single line string that describes the result of the battle. It will be one of the following:
- " wins against !" if the first PokeScan wins.
- " wins against !" if the second PokeScan wins.
- "It's a tie between and !" if the battle is a tie.## sample
Pikachu 25 electric
Charmander 20 fire
Pikachu wins against Charmander!