/*
Online Java - IDE, Code Editor, Compiler

Online Java is a quick and easy tool that helps you to build, compile, test your programs online.
*/
import java.util.*;

class RepeatDecimalFractions
{
    long numeratorOriginalLong;
    long denominatorOriginalLong;
    String partialEquationTwo;
    boolean singleDigitrecurring;
    String fractionalPart;
    String[] testOne;
    long divisor;
    boolean successReducedNumerator;
    boolean successReducedDenominator;
    boolean isTerminatingDecimal=true;
    List<Long> notPrimeLst = new ArrayList<>();
    List<Long> primeLst = new ArrayList<>();
    
    
    //My aim initially will be to understand this. We know the repetend portion has to be non-repeating, 
    //otherwise it would not be terminating.  
    //This is foundation of my first set of test cases in which I can create a fraction and then use the decimal conversion back into my code.
    //Key points about terminating fractions: 
    //Denominator key: 
    //To check if a fraction will terminate, look at its denominator in simplest form.
    //for this I will use reducedDenominator() and reducedNumerator()
    //If the denominator only has prime factors of 2 and/or 5, the fraction will terminate
    
    //I have found this from BBC site:
    
    //There are many methods to find the prime factors of a number, 
    //but one of the most common is to use a prime factor tree:

    //Start the factor tree using any pair of factors (two numbers that multiply together to make your number).
    //If one of these factors is prime, that branch ends.
    //If a factor isn't prime, divide it into a factor pair.
    //The branches continue to expand until all the factors are prime numbers.
    //The final answer is the list of all the prime numbers displayed at the end of these branches.
    
    public void generateTerminatingNonRepeatFractions()
    {
        //rather than calling another method for confusion, I will include same code again...
        //I will try to generate denominators without prime factors (excluding 1)
        //we know I need to go up to 32 767 limit for length of X as per documentation for  1.XXXXXXXXXX
        //However to perform division, it will be subject to limits of the Long.
        //this will be a similar concept to addition challenge..
        //but this time i can use recursion aspect since in addition we discarded least significant digit and worked towards
        //mot significant digit
        //The biggest long number is:  2147483647  (this is 10 digits wide)
        
        long [] testing = new long[19];
        
       //System.out.println("CUJRRRENT NUM: " + numeratorOriginalLong); 
        
        //long a = 2147483647; 
        long a = 2000;
        boolean primeNumber=false;
        
        long temp = a/a;
        
        long count=0;
        
        long arraySize = 2147483647;
        
        //not permitted
        long [] noPrimeFactor = new long[21474836];
        long startNum=2;
        
        
        //want to check each long (which will be initially in a string)
        //for its prime factors..
        
        for (long m=startNum; m<a;m++)
        {
            primeNumber=true;
            //we know prime numbers can only be divided by 1 and itself.. so these are excluded.
            //no need to run this to this beyond half of the length of m
            //System.out.println("Checkin num: " + m);
             
            for (long j=2; j<m;j++)
            {
                //System.out.println("val j: " + j);
                
                if (m%j==0 && m>3)
                {
                    //we need to pass this outcome back into factor tree
                    //but its a starting point to try and figure out if it is only exactly divisible by
                    //2 and 5 to satisfy the condition...
                    
                    //System.out.println("is not a prime number: " + m);
                    notPrimeLst.add(m);
                    primeNumber=false;
                    
                    break;
                }
            }
            count++;
            
            if (primeNumber || (m>0 && m<3))
            {
            //we know that is only worth generating a fraction with a test case with following denominator
            //we know these can not  be divisible by 2 and 5...
            //System.out.println("is a prime number: " + m);
            
            //System.out.println("is a prime number: " + m);
            primeLst.add(m);
            //noPrimeFactor[count] = m;
            }
            
        }
        
    }
    
    
     
    public boolean reducedNumerator(Long numerator, long divisor)
    {
        //System.out.println("Inside reducing numerator");
        //System.out.println("This is the divisor: " + divisor);
        if (divisor>numerator)
        {
            return false;
        }
        else
        {
            if (numerator%divisor==0)
            {
                successReducedNumerator = true;
                return successReducedNumerator;
            }
        }
        return false;
    }
    
    public boolean reducedDenominator(long denominator, long divisor)
    {
        //System.out.println("inside reducing denominator");
        //System.out.println("This is the divisor: " + divisor);
        
            if (denominator%divisor==0)
            {
                successReducedDenominator = true;
                return successReducedDenominator;
            }
            return false;
    }
    
    public void numeratorDenominatorReduction()
    {
        
    }
    
    long startPoint = 2;
    
    //if it is a terminating Decimal, not interested in checking if repetend...
    //not sure how to check if terminating decimal...
    //since can also have a longer decimal which terminate successfully such as 0.1875
    
    //If the denominator only has prime factors of 2 and/or 5, the fraction will terminate
    
    public boolean terminatingDecimal(long primeFactorCheck, long numerator, String decimalOriginal)
    {
        int counter=0;
        long denominatorDivisiblePrimeFactor=0;
        isTerminatingDecimal=true;
        List<Long> terminatingDecimalLst = new ArrayList<>();
        boolean primeFactorTwo=false;
        boolean primeFactorFive=false;
        int pos=0;
        String [][] originalDenominatorDividePrime = new String[2000][2];
        String [][]originalDenominatorDivideNonPrime = new String[2000][2];
        double numeratorDividePrimeNumber;
        boolean executeOnce=true;
        
        Iterator<Long> f = primeLst.iterator();
        
        
        
        
        //for (int i=0; i<testOne.length; i++)
        //{
            //System.out.println("PROCESS HERE: " + i);
             System.out.println("************************************************");    
        System.out.println("This will just be final part of the code...");
        System.out.println("Since several prime numbers have been generated, I will use the existing numerator");
        System.out.println("And store the results in a String array:   Numerator/prime number AS fraction  and Numerator/prime number AS decimal  and store results.  IT IS TO GET A FEEL OF DIFFERENT PATTERNS AS EXPLORED IN DOCUMENTATION!");
        System.out.println("This will provide a sample should I wish to populate initial array also! ");
        System.out.println("**************************************************");
        
        
        System.out.println("CHECK TO SEE IF ORIGINAL FRACTION IS TERMINATING: ");    
            
        while (f.hasNext())
        {
            pos=0;
            long item = f.next();
            counter++;
            //long item = f.hasNext();
            //System.out.println(item + " in prime number list");
            
            
            if (item==2 && primeFactorCheck>=item)
            {
                if (primeFactorCheck%2==0)
                {
                    primeFactorTwo=true;
                }
            }
            
            if (item==5 && primeFactorCheck>=item)
            {
                if (primeFactorCheck%5==0)
                {
                    primeFactorFive=true;
                }
            }
            
            //here if we want, we can potentially grow the code
            //can perform number / primeFactor other than 2 and 5
            //it would be interesting to see lengths of the repetend
            
            // can try to call
        
        numeratorDividePrimeNumber = (double)(numeratorOriginalLong)/(double)(item);
        
        //System.out.println(counter);
        //System.out.println(pos);
            
            if (executeOnce)
            {
            
            if (primeFactorFive || primeFactorTwo)
            {
System.out.println("Terminating fraction since reduced denominator is divisble by prime number of two or five");

        System.out.println(decimalOriginal + " is a periodic number");
                
                //return true;
            }
            else
            {
                System.out.println("NOT Terminating fraction since reduced denominator is NOT divisble by prime factor of two or five");
            }
            executeOnce=false;
          }
          
          //************THIS CAN BE TURNED OFF IF REQUIRED, JUST USEFUL FOR GENERATING VALID TEST CASES***********
        originalDenominatorDividePrime[counter][pos] = numeratorOriginalLong + "/" + item;
        originalDenominatorDividePrime[counter][pos+1] = String.valueOf(numeratorDividePrimeNumber);
        
        System.out.println("Original numerator / PRIME number AS FRACTION (not reduced) => " + originalDenominatorDividePrime[counter][pos]);
        System.out.println("Original numerator / PRIME number AS DECIMAL => " +originalDenominatorDividePrime[counter][pos+1]);
//************THIS CAN BE TURNED OFF IF REQUIRED, JUST USEFUL FOR GENERATING VALID TEST CASES***********
          
        }
        
    //}
        
        return false;
    }
        
        /*
        
        if (primeFactorCheck!=2 && primeFactorCheck!=5)
        {
            for (denominatorDivisiblePrimeFactor=startPoint;denominatorDivisiblePrimeFactor<2147483647;denominatorDivisiblePrimeFactor++)
            {
            //we know it can NOT be a terminating number if this satisfies
            if (denominatorDivisiblePrimeFactor%primeFactorCheck==0)
            {
                isTerminatingDecimal=false;
                return false;
                //break;
            }
            }
        }
        if (!isTerminatingDecimal)
        {
            //but now, we should really check it against %2 or %5 just incase....
            //since we know both these conditions need to satisfy and give terminating
            //We need to be careful that is has to performed on denominator that has been
            //reduced to lowest fraction part....
            
            //we know the value of the denominator is at the end of this method...
            //public void fraction(String[] testOne)
            //***IMPORTANT FLOW OF CODE **********
            
        //  fraction (but method call appears immediately). This method gets numerator and denominator in most
        //reduced form => 
        //generateTerminatingNonRepeatFractions    
        //This method identifies prime and non prime numbers
        //it passes prime number (lowest first) into method terminatingDecimal. 
        //Issue is in order to check
        //if terminating decimal, it is required to know the denominator in most reduced form...
        //however this is completed at bottom of the fraction part.=>
        //so terminatingDecimal can only be called once fraction method finished
        //terminatingDecimal =>
            
        System.out.println("Denominator: " + denominatorDivisiblePrimeFactor + " is terminating.");
        startPoint = denominatorDivisiblePrimeFactor;   //next time around, no need processing all
        //proessed denominstors for which we checked if terminating/non-terminating..
        
        terminatingDecimalLst.add(denominatorDivisiblePrimeFactor);
        }
        
        return true;
        */
        
    
    
    
     public void compareInputOutput()
    {
        
    }
    public void repetendLength()
    {
        
    }
    public boolean periodicNumber()
    {
        return true;
    }
    
    public void checkRecurrence()
    {
        if(fractionalPart.length()>1)
        {
        do
        {
            //System.out.println("HERE");
            
        
        if (fractionalPart.charAt(0)==fractionalPart.charAt(fractionalPart.length()-1))
        {
            System.out.println("IN HERE11");
            
            singleDigitrecurring = true;
            //System.out.println("same digit");
            fractionalPart=fractionalPart.substring(1);
            
            partialEquationTwo = partialEquationTwo + fractionalPart.charAt(0);
            
            
        }
        else
        {
            //it needs this state to set it back to false..
            //since if there is a fraction such as 0.343
            //it would initially enter if due to digit 3 at front and end.
            //so singleDigitrecurring=true...  But with the 4 in middle, it prevents it being a single
            //System.out.println("NOT HERE2222");
            singleDigitrecurring = false;
            break;
        }
        //need minimum two required to allow indexing
        }while(fractionalPart.length()>1);
        
        
        
        }
        //System.out.println("STATE1: " + singleDigitrecurring);
        
    }
    
    
    //this needs to be given a larger set to properly test primeFactorTwo and primeFactorFive check
    public void fraction(String[] testOne)
    {
        boolean improperFraction=false;
        String temp;
        long posTestOneDecimal=0;
        long posTestOneFraction;
        String numeratorOriginal="";
        String denominatorOriginal="";
        String decimalOriginal="";
        long denominatorIntoNumerator;
        String remainingFraction="";
        String decimalPortionOriginal="";
        
        
        generateTerminatingNonRepeatFractions();
        
        StringTokenizer st = new StringTokenizer (testOne[0], ",");
        //boolean singleDigitrecurring=false;
        
        
        
        while (st.hasMoreTokens())
        {
            
           singleDigitrecurring=false;   
            temp= st.nextToken().toString();
            decimalOriginal=temp;
            
            posTestOneDecimal++;
            System.out.println("\n*** The Decimal presented: " + temp);
            decimalPortionOriginal = temp.substring(temp.indexOf("."));
        
        fractionalPart = temp.substring((temp.indexOf(".")+1));
        String fractionalPartionWithDecimal = temp.substring((temp.indexOf(".")));
        long numerator = Long.valueOf(fractionalPart);
        //long numerator = numeratorOriginalLong;    
        partialEquationTwo="";
        String fullEquationOne=temp;
        Long equationTwoA;
       
        long denominator=0;
        long wholeNumberBeforeFractionLong=0;
        String numeratorToString;
        
        //logic for 0.777777777777777.. We know looking at YouTube video and own knowledge, that the fraction
        //will not reduce, I consider this the best option in order to maximise the length of the fractional part
        //and not stressing the executions..
        
         //note to perform logic on 0.242424, my main code is able to handle the situation
        //but there is still scope to handle this similar to 0.7777777
        //It is dealing with length of the the repetend, which was a critical part of my documentation
        //so it seems worthwhile applying this logic here.....
        //but ultimately to ensure we do not run into issues, the fractionalPart has to be long enough to test
        //length n of repetend since it requires 2 x n minimum...
        //otherwise will need to try and catch
        //0.2424 similar to 0.77777
        //Equation one =  0.2424    Equation Two = 24.2424
        //equation 2a = difference = 24
        //remainingFraction=24/99
        //issue that will occur is 24/99 can be reduced, but I have prevented my code from entering there
        //!singleDigitrecurring
        //if multiple digit re-curring, i need to send it to this area..
        //also issue is in which direction I want to take my code
        //are we accepting 0.242424    as 30303/125000 (which is the correct value).
        //so perhaps it is best not to perform the following below analysis with repetend of length 2...
        //I have a feeling also my precision will be compromised if I perform on anything other than single
        //digit wide recurring....
        //perhaps in these situations with multiple recurring, I can perform and obtain 24/99 (as below)
        //and also perform reduction on original numerator and denominator.
        //But this will break my code.. Requires thought..
        //I can perhaps look at it from perspective of recurring or just as it is..
        //My next area might be to explore other areas of my documentation..
        //I have generated so many prime numbers, it might be worth exploring decimal outputs with these...
         
         //Also how far into the long can we check for repeating
         //I know this is the limit
         //so strictly speaking, we know the length of fractionalPart
         //fractionalPartionWithDecimal
         //alterntively can perform a pattern matcher. This would not have restrictions
         //and will permit exception handling for unknown fraction lengths
         //but can still cause issue if checked in wrong location...
         
         
         //0.7777777777777787777
         
        checkRecurrence();
        //System.out.println("FLOW HERE STRAIGHT");
        //System.out.println("STATE: " + singleDigitrecurring);
        
        if (singleDigitrecurring)
        {
            System.out.println("Recurring digit through entire decimal: " + fractionalPart.charAt(0));
        String fullEquationTwo = fractionalPart.charAt(0) + "." + fractionalPart.charAt(0)+ partialEquationTwo;
        //System.out.println("FULL EQUATION ONE: " + "x"+fullEquationOne+"x");
        //System.out.println("FULL EQUATION TWO: " + "x"+fullEquationTwo+"x");
        
        equationTwoA = Long.valueOf(fullEquationTwo.charAt(0)) - Long.valueOf(fullEquationOne.charAt(0));
        //System.out.println("FULL EQUATION TWO A: " + "x"+equationTwoA+"x");
        
        numerator = equationTwoA;
        denominator = 9;
        //denominator=9;
        remainingFraction = numerator + "/" + 9;
        
        System.out.println("Fraction of recurring: " + remainingFraction);
        }
        
        
         if (!singleDigitrecurring)
        {
        
        long multipliedBy;
        System.out.println("The fraction part: " + fractionalPart);
        
        multipliedBy=fractionalPart.length();
        
        long multipliedByInteger = Long.valueOf(multipliedBy);
        //System.out.println("Decimal portion of length: " + multipliedByInteger);
        
        denominator = 1;
        long i=0;
    
        while (i<multipliedByInteger)
        {
            denominator = denominator * 10;
            //System.out.println("value denominator: " + denominator);
            i++;
        }
        
        //System.out.println("Decimal portion multipled by to give whole number: " + multipliedByInteger);
        
        System.out.println("this is numerator: " + numerator);
        System.out.println("this is denominator: " + denominator);

       //note divisor can not handle 19 digit long numerator although it can view this as a long on the screen.
       //it will either session kill due to available memory
       //or process killed due to memory issues.
       //I have explored with different numerators.
       //unfortunately if it is 999, 999,999,  session will be killed.
       //trying at 900,000,000 is intermittent.
       //so I have reduced acceptable numerator 800,000,000
       
       //to at least keep a level of precision, I will remove as many digits as possible to ensure
       //numerator is less than 9 digits long....
       if (numerator>750000000)
       {
           System.out.println("Numerator" + "("+numerator+")" + " considered too large for computation");
           
           numeratorToString = String.valueOf(numerator);
           numeratorToString=numeratorToString.substring(0,8);
           System.out.println("Numerator reduced to 9 digits wide: " + numeratorToString);
           numerator = Long.valueOf(numeratorToString);
       }
       
        for (divisor = numerator; divisor>=1; divisor--)
        {
            //System.out.println("val divisor: " + divisor);
            if (reducedNumerator(numerator,divisor) && reducedDenominator(denominator,divisor))
            {
                //System.out.println("*********This is divisor: " + divisor);
                denominator = denominator/divisor;
                numerator = numerator/divisor;
                successReducedDenominator=false;
                successReducedNumerator=false;
            }
            
        }
        
        //System.out.println("******This is pos decimal: " + posTestOneDecimal);
        
        System.out.println("reduced numerator: " + numerator);
        System.out.println("reduced denominator: " + denominator);
        
        //System.out.println("**** SECOND TOKENIZER **********");
        //System.out.println("**** SECOND TOKENIZER **********");
        
        }
        
        
    posTestOneFraction=0;
    StringTokenizer st1 = new StringTokenizer (testOne[1], ",");
    while (st1.hasMoreTokens())
        {
            temp= st1.nextToken().toString();
            posTestOneFraction++;
            ///System.out.println("******This is pos Fraction part: " + posTestOneFraction);
            //System.out.println("CURENTLY IN TEMP: " + temp);
            
            
            if (posTestOneDecimal==posTestOneFraction)
            {
                ///temp= st1.nextToken().toString();
                System.out.println("Fraction presented is: " + temp );
                
                
                    //****************
            //numbers in this format
                //need to perform a tokenizer of these..
                //we know it will refer to correct location if the counter in here
                //matches other two Tokenizers...
                //delimter is a comma.
                //it then gets index of the - and rest digits after it
                //if no -,  then it can do whole tokenizer again looking for a /
                //first token is numerator, second is denominator
                //it can be compared against reducd numerator and reduced denominastor 
                //gives string after this
                
                //testOne[1]="3/6, 1/2, 1-1/4, 123/10000, 1/10000, 999/1000, 15/100, 86/100, 10-2/5, 23-1/2, 3/4";
            
            
            
            //temp= st2.nextToken().toString();
            
            
            if (temp.indexOf('-')!=-1)
            {
                numeratorOriginal = temp.substring((temp.indexOf('-')+1), temp.indexOf('/'));
                denominatorOriginal = temp.substring(temp.indexOf('/')+1);
                //testOne[1]="3/6, 1/2, 1-1/4, 123/10000, 1/10000, 999/1000, 15/100, 86/1
            }
            
            
            //if it does not find a  - in the String, it means no whole number
            //easier to extract
            if (temp.indexOf('-')==-1)
            {
                numeratorOriginal = temp.substring(0,temp.indexOf('/'));
                denominatorOriginal = temp.substring(temp.indexOf('/')+1);
                //can perform tokenizer again with /
            }
            
            
              //System.out.println("reduced numerator: " + numerator);
             //System.out.println("reduced denominator: " + denominator);
             
             //this is the first point that we know that end user has not provided
             //approximation of pi as decimal and fraction of pi
             //although we know that 22/7 is never going to give a terminating decimal
             //this is a valid exercise...
             
             //in this instance, it has only produced the fractional part in the exercise.
             //so it is impossible to compare the initial fractional state with that produced in calculation.
             //we can in practice convert the improper fraction to a proper fraction...
             
             //System.out.println("***********");
             //System.out.println(numeratorOriginal);
              //System.out.println(denominatorOriginal);
              
             // System.out.println("***********");
             
             
             long decimalOriginalLong = Long.valueOf(denominatorOriginal);
             numeratorOriginalLong = Long.valueOf(numeratorOriginal);
             decimalOriginalLong=Long.valueOf(denominatorOriginal);
             
             double result = 0;
             String properEntireOriginalFraction="";
             String originalFraction=temp;
             long remainingNumerator=0;
             
             //improper fraction
             if (decimalOriginalLong<numeratorOriginalLong)
             {
                 //System.out.println("FUK: " + numeratorOriginal);
                 //System.out.println("FUK: " + denominatorOriginal);
                 
                 denominatorIntoNumerator = Long.valueOf(numeratorOriginal)/Long.valueOf(denominatorOriginal);
                 System.out.println("Original numerator/denominator:" + denominatorIntoNumerator);
                 
                 remainingNumerator = Long.valueOf(numeratorOriginal) - (Long.valueOf(denominatorOriginal) * denominatorIntoNumerator);
                 System.out.println("remaining numerator: " + remainingNumerator);
                 
                 remainingFraction = remainingNumerator + "/" + denominatorOriginal;
                 System.out.println("remiaining fraction: " + remainingFraction);
                 System.out.println("Fraction provided in challenge is improper: " + temp);
                 originalFraction = temp;
                 //System.out.println(test);
                 
                 try
                 {
                     
                 String wholeNumberBeforeFraction = temp.substring(0,temp.indexOf("-"));
                 wholeNumberBeforeFractionLong = Long.valueOf(wholeNumberBeforeFraction);     
                 }
                 catch (StringIndexOutOfBoundsException e)
                 {
                     System.out.println("Improper fraction with no existing whole number in front");
                 }
                 
                 temp=remainingFraction;
                 numeratorOriginal = temp;
                 
                 //need to also add existing whole number that was there with the
                 //whole units generated from improper => proper fraction part conversion...
                 
properEntireOriginalFraction = ((denominatorIntoNumerator+wholeNumberBeforeFractionLong) + "-" +remainingFraction);
                 
                 System.out.println("Proper entire fraction is: " + properEntireOriginalFraction);
                 
                 improperFraction=true; 
             }
             
             
             if (numeratorOriginal.equals(String.valueOf(numerator)) && denominatorOriginal.equals(String.valueOf(denominator)))
             {
                 System.out.println("fraction provided in challenge is fully reduced: " + temp);
                 System.out.println("Original fraction" + "("+temp+")" + " provided is exact representation of the initial decimal conversion: " + "0"+decimalOriginal);
             }
             
             else
             {
                 System.out.println("Fraction provided in challenge: " + temp + " might not be correctly reduced " + "("+numerator+"/"+denominator+")");
                 
                 if (improperFraction)  
                 {
                      //this would need be same limit as longest variable in test
                     //System.out.printf("%.5f", dec);
                     result = (double)remainingNumerator/Double.valueOf(denominatorOriginal);
                     
                 System.out.println("1Original fraction"+"("+originalFraction+")" + "has been changed to proper fraction"+"("+properEntireOriginalFraction+"). Remaining fraction is: " + remainingFraction + " is non- representation of the initial decimal conversion: " + "0"+decimalPortionOriginal);
                 System.out.println("1Remaining fraction " + remainingFraction + " in decimal is " + result + " and NOT:" + "0"+ decimalPortionOriginal);
                     
                     //System.out.println(numerator);
                     //System.out.println(denominator);
                     double dec = (double)numerator/(double)denominator;
                     //System.out.println(dec);
                     
                     double numeratorDouble = Double.parseDouble(remainingFraction.substring(0,remainingFraction.indexOf("/")));
                     double denominatorDouble = Double.parseDouble(remainingFraction.substring(remainingFraction.indexOf("/")+1));
                     
                     //bd1 = new BigDecimal(numeratorDouble);
                     //System.out.println("bd1: " + bd1);
                     //bd2 = new BigDecimal(denominatorDouble);
                     //System.out.println("bd2: " + bd2);
                     
                     //this will suggest it is a non-terminating decimal
                     try
                     {
                         result= numeratorDouble/denominatorDouble;
                         //System.out.println("THIS RESULT: " + result);
                     }
                     //we know that if division does not reach this precision, then it is terminating.
                     catch (ArithmeticException e)
                     {
                         result = dec;
                     }
                 }
                     
                     else
                     {
                         
                         result= Double.parseDouble(numeratorOriginal)/Double.parseDouble(denominatorOriginal); 
                         //System.out.println(numerator);
                         //System.out.println("HERERERERE");
                         //System.out.println(denominator);
                 
                     System.out.println("2Original reduced fraction provided " + temp + " is non- representation of the initial decimal conversion: " + "0"+fractionalPartionWithDecimal);
                     System.out.println("1Remaining original + fraction" + "(" + temp +")" +" in decimal is " + result + " and NOT:" + "0"+decimalPortionOriginal);
                
                     }
                     
                    
                 
                 improperFraction=false;
                 }
                 
                 
            }
            
            //***************            break;
            }
            
    terminatingDecimal(denominator, numerator,decimalOriginal);
        
    }
    
        }
    
    public RepeatDecimalFractions(String[] testOne)
    {
        this.testOne=testOne;
        fraction(testOne);
    }
}

public class Main
{
    public static void main(String[] args) {
        
        String[] testOne = new String[2];
      
       
        //This is my maximum length for a test scenario, it doesnt matter if I choose the single digit recurring
        //or the reduction route. Precision is limited to 20 digits
        
        //Ensure numerator is less than 800,000,000  otherwise the code will perform this translation....
        //by truncating digits required.
        
        
        //testOne[0]="0.343,0.01100550275137568784,0.242424,0.1875325,0.7777777777777787777, 0.5, 1.25, 0.0123, 0.0001, 0.999, 0.15, 0.86, 10.4, 23.5, 0.75, 3.1425";
        
        //testOne[1]="1/3,22/1999,30303/125000,75013/400000,1-777/100,1/2,1-1/4,123/10000,1/10000,999/1000,15/100,86/100,10-2/5,23-1/2,3/4,22/7";
        
        testOne[0]="0.750000001,1.1,3.142857,0.192367,0.10973";
        testOne[1]="2/3,10/9,22/7,5343/27775,823/7500";
        
        
        RepeatDecimalFractions rdf = new RepeatDecimalFractions(testOne);
        
        System.out.println("Welcome to Online IDE!! Happy Coding :)");
        
    }
}