public class Example {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.println("Enter Words");
String text=s.nextLine();
int count=1;
String t[]=text.split(" ");
for(int i=1;i
count++;
}
System.out.println("No of words : - " + count);
}
}
output is :-
Enter Words
hello deep how r u ?
No of words : - 6
No comments:
Post a Comment