title: how do i get my code to calculate the number of place correct place values?
body: <p>I am not really good at coding and I've been confused in this step where I don't know to make my code read the correct number of place values. </p>
  
  <p>For example I run my code and it generates 5 random numbers then I input 5 random numbers the output of this would be "They share 0 numbers in the right place value. </p>
  
  <p>For example,in order for me to get what I want, I get 5 random generated numbers which are 54123, I input 00123 it would say they hold 3 numbers in the right place value.</p>
  
  <p>//this is what I think something needs to be edited
  //This is my whole code on a google doc: <a href="https://docs.google.com/document/d/1ug1rRNwgZwBAf9kvaeAEFoo81r_W9Br6rRX4xc0fFUk/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/document/d/1ug1rRNwgZwBAf9kvaeAEFoo81r_W9Br6rRX4xc0fFUk/edit?usp=sharing</a>
  //I didn't enter my whole code on this post because I think it is to long and the only part I want is where it can calculate how many numbers in the right place value</p>
  
  <pre><code>    System.out.println(s);
      String f = scan.next();
  
      for(int p=0; p&lt;s.length(); p++) {
          for(int z=0;z&lt;f.length();z++){   
              if (s.substring(p,p+1).equals(f.substring(z,z+1))){
                  n++;
              } }}
      int rt= 0;
      for(int p=0; p&lt;s.length(); p++) {
          for(int z=0;z&lt;f.length();z++){
  
              // this where i count the numbers in the right place
              rt=99;
              } }
      System.out.println(" They share " + rt + " numbers in the right place value");
      System.out.println(" They share " + n + " numbers in common");
  
  
      System.out.println("guess number 1");
              if(n ==5){
                  System.out.println(" Congratulations you win! ");
                  System.exit(0);
  
              }
  </code></pre>