We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
hi ,
I think you are using next() function ,so it receives first word only .It doesnot allow space.
If you use nextLine(),you will get problem of not taking input from user(doesnot scan from keyboard).One point we should notice that initialy cursor was in the previous line from which it takes input .If you dont clear buffer memory it takes that as an input .So before using nextline() function to receive string. annonymously call nextline() function
THen you will get expected output
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
hi , I think you are using next() function ,so it receives first word only .It doesnot allow space. If you use nextLine(),you will get problem of not taking input from user(doesnot scan from keyboard).One point we should notice that initialy cursor was in the previous line from which it takes input .If you dont clear buffer memory it takes that as an input .So before using nextline() function to receive string. annonymously call nextline() function THen you will get expected output