Skip to content

Instantly share code, notes, and snippets.

@martin0s
martin0s / Main.java
Created July 20, 2020 16:02
Text Wrap Problem Write a program that takes an input string and prints it as multiple lines of text such that no line of text is greater than 13 characters and words are kept whole.
public class Main
{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String text;
//reading input
System.out.print("Enter text: ");
text=input.nextLine();
public class Main
{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String text;
//reading input
System.out.print("Enter text: ");
text=input.nextLine();