Skip to content

Instantly share code, notes, and snippets.

@boyanov83
Created September 15, 2014 15:15
Show Gist options
  • Save boyanov83/c83184c6b7f87df593c2 to your computer and use it in GitHub Desktop.
Save boyanov83/c83184c6b7f87df593c2 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class _02_SequencesOfEqualStrings
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
String[] input = scan.nextLine().split(" ");
String lastWord = input[0];
for (String word : input)
{
if (!(word.equals(lastWord)))
{
System.out.println();
}
System.out.print(word + " ");
lastWord = word;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment