-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ch4113ng3.java
32 lines (26 loc) · 871 Bytes
/
Ch4113ng3.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.smlnskgmail.jaman.codewarsjava.kyu7;
import java.util.Arrays;
import java.util.stream.Collectors;
// https://www.codewars.com/kata/59e9f404fc3c49ab24000112
public class Ch4113ng3 {
private final String input;
public Ch4113ng3(String input) {
this.input = input;
}
public String solution() {
return Arrays
.stream(input.split(""))
.map(s -> {
String lowerCaseString = s.toLowerCase();
switch (lowerCaseString) {
case "a":
return "4";
case "e":
return "3";
default:
return s.equals("l") ? "1" : s;
}
})
.collect(Collectors.joining());
}
}