SPACE SEPARATED INPUTTING

Hello world, I am a beginner in the world of programming and am trying coding these days…As such I just know JAVA(upto school level)…Now I am facing this very difficult task here in Codechef as to how to input efficiently space separated no.In C, I’ve learnt there is a input function which uses space as delimiter…Can you help me as to how I can do so using BufferedReader and NOT SCANNER CLASSES as I’ve learnt it is slower!!!Plz help me

if u want to use bufferedreader,read input in string and then split by space in another array.and use parseInt

2 Likes

Let a is an integer array , then you can do like this…

  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

     String[] s = br.readLine().split(" ");

      a[i] = Integer.parseInt(s[i]);
2 Likes

Thanks a lot :slight_smile: