String concatenation

Report a typo

Write a curried function (using lambdas) that accepts three string arguments and concatenates all in one string following the rules:

  • String cases: in the result string, first and second arguments must be in lower cases and the third argument must be in upper cases.
  • Order of arguments concatenation: first, third, second.

Solution format. You may write the result in any valid formats but with ; at the end.

An example of a curried function: x -> y -> ...;

Sample Input 1:

aa bb cc

Sample Output 1:

aaCCbb

Sample Input 2:

AAA bbb CCC

Sample Output 2:

aaaCCCbbb
Write a program in Java 17
import java.util.Scanner;
import java.util.function.Function;

class CurryConcat {

public static String calc(String first, String second, String third) {

Function<String, Function<String, Function<String, String>>> stringFun =
// write your code here

return stringFun.apply(first).apply(second).apply(third);
}

// Don't change the code below
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println(calc(scanner.next(), scanner.next(), scanner.next()));
}
}
___

Create a free account to access the full topic