407149: GYM102697 120 What the Frac (Easier Version)

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

120. What the Frac (Easier Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 10 points.

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.

Input

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

Output a single fraction $$$c$$$/$$$d$$$ in the same format as the input: the input fraction, in simplest form, as described above.

ExamplesInput
6/8
Output
3/4
Input
72/48
Output
3/2
Input
37/73
Output
37/73
Note

In this problem, the input will be small enough for a brute force solution that tries all factors to run efficiently.

加入题单

上一题 下一题 算法标签: