public String getAnswer() throws Exception {

        long prime = getNextPrime(56003);

        while (prime < 200000) {
            String primeStr = Long.toString(prime);
            for (int i = 0;i<2;i++) {
                int numPrimes = 1;
                if (primeStr.contains(Integer.toString(i))) {
                    for (int j = 0;j<10;j++) {
                        if (j!=i) {

                            //since leading zeros are not counted simply move on from strings where the first digit is replaced.
                            if (j==0 && primeStr.indexOf(Integer.toString(i))==0)
                                continue;


                            if (isPrime(parseLong(primeStr.replace(Integer.toString(i), Integer.toString(j))))) {
                                numPrimes++;
                                if (numPrimes==8)
                                    return primeStr;
                            }
                        }
                    }
                }
            }
            prime = getNextPrime(prime);
        }
        return null;
    }