Wednesday, 15 July 2015

Java Programs Made Easy

package Good.com;

import java.util.StringTokenizer;

public class Prog29 {
      static String op;

      public static void abc(String str) {
            int i, count, max = 0;
            String s, s1;
            char c;
            StringTokenizer st = new StringTokenizer(str, " ");
            while (st.hasMoreTokens()) {
                  s = st.nextToken();
                  s1 = s.toLowerCase();
                  count = 0;
                  for (i = 0; i < s1.length(); i++) {
                        c = s1.charAt(i);
                        if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
                              count++;
                  }
                  if (count > max) {
                        max = count;
                        op = s;
                  }
            }

      }

      public static void main(String[] args) {
            String str = "Appreciation is the best way to motivate";
            abc(str);
            System.out.println(op);
      }


}