nextLine and next
Submissions: 10629   Accuracy:

49.98%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork Java

Here, we will learn how  to take input of a string that comprises of multiple words. Also, we will learn to clear the input buffer. Your task is to take input of strings and integers and produce the output. We must be clear with next() and nextLine()

Note : Refer the following link to get better understanding: StackOverflow

Input Format:
First line of input contains T,  number of testcases. For each testcase, there will be two lines of input. First line contains integer, second line contains string.

Output Format:
For each testcase, print the variables in same order as taken in input.

User Task:
Your task is to complete the function getInput() to take input of strings and learn how to correctly take input.

Example:
Input:
1
5
Geeks For Geeks

Output:
5
Geeks For Geeks

** For More Input/Output Examples Use 'Expected Output' option **

Author: Dhiman Mayank


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.