title: print every third character of a user-inputted string in java
body: <p>Using For-Loop help me to write a program that print every third character of a user-inputted string. The characters not displayed are instead printed as underscores. A sample run of the program may look like this:</p>
  
  <p>Enter a string: Constantinople</p>
  
  <p>C _ _ s _ _ n _ _ n _ _ l _</p>
  
  <p>myCode:</p>
  
  <pre><code>public class Ex02ForLoop {
  public static void main(String[] args) {
      //name of the scanner    
      Scanner scanner = new Scanner(System.in);
  
      //initialize variable
      String userInput = "";
  
      //asking to enter a string
      System.out.print("Enter a string: ");
  
      //read and store user input
      userInput = scanner.next();
  
      //using For-Loop displaying in console every third character
      for (int i = 0; i &lt;= userInput.length(); i+=3)
      {   
          System.out.print(userInput.charAt(i) + " _ _ ");    
      }
      scanner.close();
  }}
  </code></pre>
  
  <p>But My output is:
   C _ _ s _ _ n _ _ n _ _ l _ _ 
  need to do something to put the right qty of underscores
  Thank you</p>