Hdu 2027 Java function water too ~ ~ ~ ~

Source: Internet
Author: User

Import java.util.*;class main{public static void Main (String args[]) {Scanner sc = new Scanner (system.in);   while (Sc.hasnext ()) {/* *.hasnext () can continuously input multiple sets of test data */int n=sc.nextint ();                                     Sc.nextline ();   /* Accept newline characters */for (int i=1;i<=n;i++) {String str = sc.nextline ();                   Char[] Ch=str.tochararray ();                     /* Convert string str to CHAR-type array */print (' A ', count (' A ', ch));    /* Call in function: Call the Count function in the function print */print (' E ', count (' e ', ch));    Print (' I ', count (' I ', ch));    Print (' O ', count (' O ', ch));    Print (' U ', count (' U ', ch));                      if (i!=n) {System.out.println (); /* No two sets of output data, plus a newline */}}}}static void print (char str,int a) {/* output function Print */System.out. println (str+ ":" +a);}     static int count (char str,char[] CHS) {/* counter function */int n=0;  for (int i=0;i<chs.length;i++) {if (CHS[I]==STR) {/*Encountered a statistic I needed, I n++ */n++;                                       }} return n; /* Returns an int is the number of statistics */}}

Hdu 2027 Java function water too ~ ~ ~ ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.