public static int numDoubleLetters(String filename)
    throws FileNotFoundException {
  int count = 0;
  Scanner in = new Scanner(new File(filename));
  while (in.hasNext()) {
    if (hasDoubleLetter(in.next())) {
      count++;
    }
  }
  return count;
}

public static boolean hasDoubleLetter(String word) {
  for (int i = 1; i < word.length(); i++) {
    if (word.charAt(i) == word.charAt(i - 1)) {
      return true;
    }
  }
  return false;
}
