Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.77 KB | None | 0 0
  1. import java.util.*;
  2. class TestClass {
  3.     public static void main(String args[] ) throws Exception {
  4.         /*
  5.          * Read input from stdin and provide input before running
  6.          * Use either of these methods for input
  7.  
  8.         //BufferedReader
  9.         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  10.         String line = br.readLine();
  11.         int N = Integer.parseInt(line);
  12.  
  13.         //Scanner
  14.         Scanner s = new Scanner(System.in);
  15.         int N = s.nextInt();
  16.  
  17.         for (int i = 0; i < N; i++) {
  18.             System.out.println("hello world");
  19.         }
  20.         */
  21.        
  22.         Scanner sc = new Scanner(System.in);
  23.         int t = sc.nextInt();
  24.         int count = 0;
  25.         String s;
  26.         int length;
  27.         char ch;
  28.        
  29.        
  30.         for(int i = 0; i < t; i++){
  31.             length = sc.nextInt();
  32.             s = sc.nextLine();
  33.            
  34.            
  35.             for(int j = 0; j < length; j++){
  36.                 ch = s.charAt(j);
  37.                 if(ch >= '0' && ch <= '9'){
  38.                        
  39.                        
  40.                     //do{
  41.                         //j++;
  42.                     //}while(ch >= '0' && ch <= '9');
  43.                     do{
  44.                        
  45.                    
  46.                         j++;
  47.                     }while(ch >= '0' && ch <= '9');
  48.                     count++;
  49.                 }
  50.                    
  51.                    
  52.                  
  53.                    
  54.                      
  55.             }
  56.             //System.out.println(count);
  57.             //count = 0;  
  58.         }
  59.        
  60.         System.out.println(count);
  61.          
  62.     }
  63.            
  64.            
  65.            
  66.            
  67.        
  68.      
  69.        
  70.    
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement