This content is archived!
For the 2018-2019 school year, we have switched to using the WLMOJ judge for all MCPT related content. This is an archive of our old website and will not be updated.Problem
Nancy is in second grade and has just begun to learn about fractions. She’s particularly intrigued by the fact that four eighths, two quarters and one half are all equal! However, because she isn’t used to working with big numbers, she prefers that her fractions’ numerators and denominators be expressed using the smallest numbers possible. Can you build a program Nancy can use to simplify her fractions?
Input
Each test case contains two integers, N, D (1 \leq N \le D \leq 10000), the numerator and denominator of a fraction, separated by a forward slash.
Output
For each test case, output the corresponding simplified fraction.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Editorial
Read only if you are stuck or have already solved the problem.