Created
September 15, 2014 15:15
-
-
Save boyanov83/c83184c6b7f87df593c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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