Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. class FastScanner
  2. {
  3.     BufferedReader br;
  4.     StringTokenizer stok;
  5.  
  6.     FastScanner (InputStream is)
  7.     {
  8.         br = new BufferedReader(new InputStreamReader(is));
  9.     }
  10.    
  11.     String nextToken() throws IOException {
  12.         while (stok == null || !stok.hasMoreTokens()) {
  13.             String s = br.readLine();
  14.             if (s == null) {
  15.                 return null;
  16.             }
  17.             stok = new StringTokenizer(s);
  18.         }
  19.         return stok.nextToken();
  20.     }
  21.  
  22.     int nextInt() throws IOException {
  23.         return Integer.parseInt(nextToken());
  24.     }
  25.  
  26.     long nextLong() throws IOException {
  27.         return Long.parseLong(nextToken());
  28.     }
  29.  
  30.     double nextDouble() throws IOException {
  31.         return Double.parseDouble(nextToken());
  32.     }
  33.  
  34.     char nextChar() throws IOException {
  35.         return (char) (br.read());
  36.     }
  37.  
  38.     String nextLine() throws IOException {
  39.         return br.readLine();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement