import java.util.*;
public class Strlne
{
public static void main (String[] args)
{
Scanner s = new Scanner (System.in);
String strs;
int count=0;
System.out.println("Enter the Sentance & Press count Ctrl+z to count Word");
while(s.hasNext())
{
strs = s.next();
count = count+1;
System.out.printf("%s\n",strs);
}
System.out.printf("Total Lines are %d\n",count);
}
}
No comments:
Post a Comment
Thank You !