eolymp
Problems

Java Reduce a fraction

Java Reduce a fraction

Reduce a fraction to the lowest terms.

Implement a class Fraction that uses a wrapper class MyLong.

class MyLong // Java
{`
  private long a; // one private variable
  MyLong(long a) // Constructor
  public String toString() // Print a variable of type MyLong
  public MyLong Abs() // return the absolute value of variable of type MyLong
  public long GetValue() // return the value of private variable of type long
  private static long gcd(long a, long b) // find the GCD of two variables of type long
  public static MyLong gcd(MyLong a, MyLong b) // find the GCD of two variables of type MyLong
  public MyLong Divide(MyLong a) // divide two numbers
};

class Fraction
{
  MyLong numerator, denominator; // numerator and denominator
  Fraction() // Constructor
  Fraction (MyLong numerator, MyLong denominator) // Constructor
  public String toString() // Print a variable of type Fraction
  public Fraction Reduce() // Reduce a Fraction
};

Input

Two integers a and b (-1018a, b1018).

Output

Print the reduced fraction in the form a / b.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4 8
Output example #1
1/2