import java.util.Scanner;
public class Count {
public static void main(String[] args) {
for (int count = 1; count <= 5; count ++) {
System.out.println("Please enter some text: ");
Scanner keyboard = new Scanner(System.in);
String text = keyboard.nextLine();
int HowLong = text.length();
String MinusTrailing = text.trim();
int CMinusTrailing = MinusTrailing.length();
String NB = MinusTrailing;
int countChar = 0;
int limit = NB.length();
for(int i = 0; i < limit; ++i)
{
if(Character.isWhitespace(NB.charAt(i)))
{
++count;
}
}
System.out.println(HowLong);
System.out.println(CMinusTrailing);
System.out.println(countChar );
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment