Question: Strings batch 1 and batch 2 are read from input. Each string consists of at least two colors, separated by + and surrounded

Strings batch 1 and batch2 are read from input. Each string consists of at least two colors, separated by "+" and surrounded th
"l" and "]". Assign all Lasts with the last color from each string, separated by "+".
Ex: If the input is:
[violet+sienna]
[bluetochre]
then the output is:
sienna+ochre
import java.util.Scanner;
public class JoinMultipleLasts {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
String batch1;
String batch2;
String lastOfBatch1;
String lastOfBatch2;
String allLasts;
batch1= scnr.nextLine();
batch2= scnr.nextLine();
/* Your code goes here */
System.out.println(allLasts);
Strings batch 1 and batch 2 are read from input.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!