Little correction please. I couldn't get test case 4
Average word problem Java You are given a statement and you are asked to find average letter per word import java.util.Scanner; public class Program { public static void main(String[] args) { int b=0; Scanner sc = new Scanner(System.in); String s = sc.nextLine(); s = s.replaceAll("\\p{Punct}",""); char[] arr = s.toCharArray(); for (int i=0; i<arr.length; i++) { if(arr[i]==' '){ b++;} } double totalword = arr.length-b; double numberofword = b+1; double average =totalword/numberofword; double o = Math.round(average); if(o<average){ int r = (int)o; System.out.println(r+1); } else { int t = (int)average; System.out.println(t); } } }