document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.util.*;
  2. public class uva494 {
  3.     public static void main(String [] args) {
  4.         Scanner scn = new Scanner(System.in);
  5.         while(scn.hasNext()) {
  6.             int count = 0;
  7.             String word = scn.nextLine();
  8.             StringTokenizer st = new StringTokenizer(word," ");
  9.             while(st.hasMoreTokens()) {
  10.                 String s = st.nextToken();
  11.                 boolean bool = false;
  12.                 int co = 0;
  13.                 for(int x=0;x<s.length();x++) {
  14.                     char c = s.charAt(x);
  15.                     if(c >= \'a\' && c<= \'z\' || c >= \'A\' && c<= \'Z\') {
  16.                         bool = true;
  17.                         co++;
  18.                     }
  19.                     else {
  20.                         bool = false;
  21.                     }
  22.                     if(!bool && co > 0) {
  23.                         count++;
  24.                         co = 0;
  25.                     }
  26.                 }
  27.                 if(bool) {
  28.                     count++;
  29.                 }
  30.             }
  31.             System.out.println(count);
  32.         }
  33.     }
  34. }
');