Omitting long strings

Report a typo

Implement the omitLongStrings method that takes a list of strings and returns a stream that consists of the elements from a given list that are less than 4 characters long.

Example: ["a", "bbb", "cccc", "dddddd"]["a", "bbb"]

Please, use streams to solve the problem.

Write a program in Java 17
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.*;

public class Main {

private static Stream<String> omitLongStrings(List<String> strings) {
// write your code here
}

public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
List<String> list = new ArrayList<>(Arrays.asList(str.split(" ")));
omitLongStrings(list).forEach(System.out::println);
}
}
___

Create a free account to access the full topic