UVA494




Sample Input

Meep Meep!
I tot I taw a putty tat.
I did! I did! I did taw a putty tat.
Shsssssssssh ... I am hunting wabbits. Heh Heh Heh Heh ...


Sample Output

2
7
10
9

Ex: hi!hello@world~  
Answer:3


import java.util.Scanner;

public class UVA494 {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);

  int count = 0;

  while (sc.hasNext()) {

   count = 0;

   int record = 0;

   String string = sc.nextLine();

   for (int i = 0; i < string.length(); i++) {

    if ((string.charAt(i) >= 65 && string.charAt(i) <= 90)
      || (string.charAt(i) >= 97 && string.charAt(i) <= 122)) {
     record = 1;
    } else {
     count += record;
     record = 0;
    }

   }

   System.out.println(count);

  }

  sc.close();
 }

}
</br>