Created
September 19, 2023 14:01
-
-
Save walidum/4bc5e1e3cd42fc9cd6e8d1a10d35c4fd 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.*; | |
import java.util.stream.Collectors; | |
public class Main { | |
public static void main(String[] args) { | |
List<String> matrix = List.of( | |
"******c********", | |
"*6****o********", | |
"******d********", | |
"******i********", | |
"***********n***", | |
"******g********", | |
"*9****g*a******", | |
"***************", | |
"******m********", | |
"******e********"); | |
String result = matrix.stream() | |
.map(s -> extract(s)) | |
.collect(Collectors.joining()); | |
System.out.println(); | |
} | |
private static String extract(String s){ | |
if (s==null) return ""; | |
return Arrays.stream(s.split("")) | |
.filter(s1 -> s1.charAt(0)>96 && s1.charAt(0)<123 ) | |
.collect(Collectors.joining()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment