Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class TestClass {
- public static void main(String args[] ) throws Exception {
- /*
- * Read input from stdin and provide input before running
- * Use either of these methods for input
- //BufferedReader
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String line = br.readLine();
- int N = Integer.parseInt(line);
- //Scanner
- Scanner s = new Scanner(System.in);
- int N = s.nextInt();
- for (int i = 0; i < N; i++) {
- System.out.println("hello world");
- }
- */
- Scanner sc = new Scanner(System.in);
- int t = sc.nextInt();
- int count = 0;
- String s;
- int length;
- char ch;
- for(int i = 0; i < t; i++){
- length = sc.nextInt();
- s = sc.nextLine();
- for(int j = 0; j < length; j++){
- ch = s.charAt(j);
- if(ch >= '0' && ch <= '9'){
- //do{
- //j++;
- //}while(ch >= '0' && ch <= '9');
- do{
- j++;
- }while(ch >= '0' && ch <= '9');
- count++;
- }
- }
- //System.out.println(count);
- //count = 0;
- }
- System.out.println(count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement