Java:
How to perceive the calculate of articulation in the shortest passage using the extract from a extract finish.
import java.io.*;
import java.util.*;
public collocate DemoShortest{
public static bereft ocean(String[] args){
try {
Finish finish = odd Finish(“Sample4.txt”);
Scanner sc = odd Scanner(file);
String continuity = “”;
while (sc.hasNext()){
continuity = continuity + sc.nextLine();
}
continuity = continuity.replace(“.”, ” , “);
String tokens[] = continuity.split(” , “);
int number = 1000;
for (int i = 0; i < tokens.length; i++){
continuity = tokens[i];
String tokens1[] = continuity.split(” “);
if (number > tokens1.length)
number = tokens1.length;
}
System.out.println(“The calculate of articulation in the shortest passage is ” + number);
}
catch (Exception e){
e.printStackTrace();
}
}
}