Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SequenceOfEqualStrings02 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String[] input = in.nextLine().split(" ");
- System.out.print(input[0]);
- for (int i = 1; i < input.length; i++) {
- if(input[i].equals(input[i-1])){
- System.out.print(" " + input[i]);
- }
- else{
- System.out.println();
- System.out.print(input[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement