Having a problem in Average Word Length(code coach)
import java.util.*; public class Program { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String k=sc.nextLine(); int a=k.length(); int x=0; for(int i=0;i<a;i++) { char s=k.charAt(i); if(s==33|s==34|s==39|s==44|s==46|s==58|s==59|s==63|s==32) { continue; } else { x++; } } int y=0; int z=0; for(int i=0;i<a;i++) { if(k.charAt(i)==32) { y++; } } z=y+1; double r=(double)x/z; int b=0; if(r==Math.round(r)) { b=(int)Math.rint(r); } else { b=((int)Math.rint(r))+1; } System.out.print(b); } }