Language: C++

import java.io.*;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String buf = br.readLine();
			boolean First = true;
			for (int i=0;i<buf.length();i++) {
				String str = "";
				while (NotStop(buf.charAt(i))) {
					str = str+buf.charAt(i);
					i++;
				}
				if (str.length()>=3&&str.length()<=6) {
					if (First) {
						System.out.print(str);
						First = false;
					}
					else System.out.print(" "+str);
				}
			}
			System.out.println("");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static boolean NotStop(char a) {
		if (a=='.'||a==' '||a==',') return false;
		else return true;
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
    4 |         public static void main(String args[]) {
      |               ^~~~~~~
      |               :
a.cc:4:33: error: 'String' has not been declared
    4 |         public static void main(String args[]) {
      |                                 ^~~~~~
a.cc:30:15: error: expected ':' before 'static'
   30 |         public static boolean NotStop(char a) {
      |               ^~~~~~~
      |               :
a.cc:30:23: error: 'boolean' does not name a type; did you mean 'bool'?
   30 |         public static boolean NotStop(char a) {
      |                       ^~~~~~~
      |                       bool
a.cc:34:2: error: expected ';' after class definition
   34 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'BufferedReader' was not declared in this scope
    5 |                 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      |                 ^~~~~~~~~~~~~~
a.cc:8:25: error: 'String' was not declared in this scope
    8 |                         String buf = br.readLine();
      |                         ^~~~~~
a.cc:9:25: error: 'boolean' was not declared in this scope; did you mean 'bool'?
    9 |                         boolean First = true;
      |                         ^~~~~~~
      |                         bool
a.cc:10:40: error: 'buf' was not declared in this scope
   10 |                         for (int i=0;i<buf.length();i++) {
      |                                        ^~~
a.cc:11:40: error: expected ';' before 'str'
   11 |                                 String str = "";
      |                                        ^~~
a.cc:12:40: error: 'NotStop' was not declared in this scope
   12 |                                 while (NotStop(buf.charAt(i))) {
      |                                        ^~~~~~~
a.cc:13:41: error: 'str' was not declared in this scope; did you mean 'std'?
   13 |                                         str = str+buf.charAt(i);
      |                                         ^~~
      |                                         std
a.cc:16:37: error: 'str' was not declared in this scope; did you mean 'std'?
   16 |                                 if (str.length()>=3&&str.length()<=6) {
      |                                     ^~~
      |                                     std
a.cc:17:45: error: 'First' was not declared in this scope
   17 |                                         if (First) {
      |                                             ^~~~~
a.cc:18:49: error: 'System' was not declared in this scope
   18 |                                                 System.out.print(str);
      |                                                 ^~~~~~
a.cc:21:46: error: 'System' was not declared in this scope
   21 |                                         else System.out.print(" "+str);
      |                                              ^~~~~~
a.cc:24:25: error: 'System' was not declared in this scope
   24 |                         System.out.println("");
      |                         ^~~~~~
a.cc:25:26: error: 'Exception' does not name a type
   25 |                 } catch (Exception e) {
      |                          ^~~~~~~~~
a.cc:26:25: error: 'e' was not declared in this scope
   26 |                         e.printStackTrace();
      |                         ^