I'm trying to count how many times the word "ing" occurred in a string asked by a user, I'm having an error saying it cannot be converted.
I tried using s.indexOf("ing")
package javaapplication3;
import java.util.*;
public class JavaApplication3 {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
    String s,q = null;
    String i = "ing";
    int count=0;
  System.out.println("Entrer une ligne de texte :");
  s = in.next();
  if ( s.indexOf("ing") ){
      count++;
  q = s.replaceAll("ing", "ed");
  }
  System.out.println("\"ing\" est occuree " +count +" fois.");
  System.out.println(q);
}
}
I expect the output would give me and count how many times it occurred but I'm having an error.
 
     
    