HDU 2017 string statistics

Source: Internet
Author: User

String statistics Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 40487 accepted submission (s): 22532


Problem description calculates the number of occurrences of numeric characters in a given string.
The input data has multiple rows. The first row is an integer N, indicating the number of test instances, followed by N rows. Each row contains a string consisting of letters and numbers.
Output: For each test instance, the number of values in the string is output, and each output occupies one row.
Sample Input
 
2asdfasdf123123asdfasdfasdf111111111asdfasdfasdf

Sample output
 
69


 
# Include <stdio. h> char a [1000]; int main () {int N; scanf ("% d", & N); getchar (); // note that while (n --) {int I, T = 0; gets (a); for (I = 0; A [I]! = '\ 0'; I ++) {if (a [I]> = '0' & A [I] <'9') T ++ ;} printf ("% d \ n", T);} return 0 ;}



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.