You are viewing a single comment's thread. Return to all comments →
Java 15 Solution using StringBuilder class:
import java.io.*; import java.util.*;
public class Solution {
public static void main(String[] args) { StringBuilder builder = new StringBuilder(); Scanner scan = new Scanner(System.in); int i = 1; while(scan.hasNext()) { builder .append(i) .append(" ") .append(scan.nextLine()) .append("\n"); i++; } scan.close(); System.out.print(builder.toString()); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java End-of-file
You are viewing a single comment's thread. Return to all comments →
Java 15 Solution using StringBuilder class:
import java.io.*; import java.util.*;
public class Solution {
}