Program is running too long...
package com.codegym.task.task18.task1816;
/*
ABCs
*/
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws FileNotFoundException {
int count = 0;
FileReader reader = new FileReader(args[0]);
Scanner scanner = new Scanner(reader);
while (scanner.hasNextLine()) {
String data = scanner.nextLine();
for (int i = 0; i < data.length(); i++) {
char ch = data.charAt(i);
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
count++;
}
}
}
System.out.println(count);
scanner.close();
}
}