| CodeRams Practice Problem Archive |
|---|
| Закончено |
Your 5-year-old cousin from the CodeRams Contest #5 (Problem 4) is now in 4th grade, and he is learning how to simplify fractions. Unfortunately, he doesn't really understand them, and he needs your help in simplifying fractions.
For this problem, you must write a program to convert a fraction $$$a$$$/$$$b$$$ to simplest form. For example, if the fraction was $$$6$$$/$$$8$$$, you can factor out a $$$2$$$, and the fraction simplifies to $$$3$$$/$$$4$$$, which is in simplest form.
The only line of input contains a single fraction $$$a$$$/$$$b$$$: the fraction you need simplify. $$$a$$$/$$$b$$$ can be greater than one, but $$$a$$$ will not be a multiple of $$$b$$$. So $$$3$$$/$$$2$$$ would be a valid input, but $$$6$$$/$$$2$$$ would not.
Output a single fraction $$$c$$$/$$$d$$$ in the same format as the input: the input fraction, in simplest form, as described above.
6/8
3/4
72/48
3/2
37/73
37/73
In this problem, the input will be small enough for a brute force solution that tries all factors to run efficiently.
| Название |
|---|


