-->
当前位置:首页 > 题库

PROGRAMMING:Easy chemistry

Luz5年前 (2021-05-10)题库529
In this question, you need to write a simple program to determine if the given chemical equation is balanced. Balanced means that the amount of elements on both sides of the "$$=$$" sign is the same.
$$$$
H_ 2O+CO_ 2=H_ 2CO_ three
$$$$
We guarantees that each chemical equation satisfies the basic rules.
If you don't know the basic rules of chemical equation writing, you can refer to the following conditions:
- The chemical equation contains **exactly** **one** "$$=$$" sign.
- For every chemical element, the first letter of each element is uppercase, and the rest of the letters are lowercase.
- The number at the end of the element represents the amount of this element needed, If there is no number, it means only one element is needed.
- Every chemical object may contain several chemical elements like $$NaCl$$.
- The number at the beginning of every chemical object represents the number of this object, If there is no number, it means only one object is needed.
- Every chemical object will be connected by "$$+$$" sign.
- Chemical reaction is considered to rearrange the atoms after they are broken up
### Input
The first line contains a single integer $$T(1\leq T \leq 100)$$, indicating the number of test cases.
In the next $$T$$ lines, each line contains a string $$S(1\leq|S|\leq100)$$, representing a Chemical equation.
It is guaranteed that $$S$$ only contains uppercase letters, lowercase letters, "$$=$$" sign and "$$+$$" sign, **the sum of the amount of all elements will not exceed $$2147483647$$**.
### Output
If the given chemical equation is balanced, please output **"Easy!"**, otherwise output **"Hard!" **( Without quotes).
### Sample Input
```in
three
H2O+CO2=H2CO3
2NaHCO3=Na2CO3+H2O+CO2
3Cu+8HNO3=3CuNO3+2NO+4H2O
```
### Sample Output
```out
Easy!
Easy!
Hard!
```







answer:If there is no answer, please comment