Language: C++


import java.util.Scanner;
import java.util.ArrayList;
import java.util.Stack;


class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	

	void solve(){
		Scanner in = new Scanner(System.in);

		while(in.hasNext()){
			String s = in.nextLine();
			//int n = 0, m = 0;
			boolean flag = true;
			Stack<Integer> st = new Stack<Integer>();

			if(s.equals(".")) break;

			for(int i = 0; i < s.length(); i++){
				if(s.charAt(i) == '(') st.push(1);
				else if(s.charAt(i) == '[') st.push(2);
				else if(s.charAt(i) == ')'){
					if(st.empty() || st.pop() == 2) {
						flag =false;
						break;
					}
				}
				else if(s.charAt(i) == ']'){
					if(st.empty() || st.pop() == 1){
						flag = false;
						break;
					}
				}
			}

			if(flag) System.out.println("yes");
			else System.out.println("no");
		}
		
	}
	

}

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.ArrayList;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Stack;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:15: error: expected ':' before 'static'
    8 |         public static void main(String[] args){
      |               ^~~~~~~
      |               :
a.cc:8:33: error: 'String' has not been declared
    8 |         public static void main(String[] args){
      |                                 ^~~~~~
a.cc:8:42: error: expected ',' or '...' before 'args'
    8 |         public static void main(String[] args){
      |                                          ^~~~
a.cc:12:2: error: expected ';' after class definition
   12 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:9:17: error: 'Solve' was not declared in this scope
    9 |                 Solve s = new Solve();
      |                 ^~~~~
a.cc:10:17: error: 's' was not declared in this scope
   10 |                 s.solve();
      |                 ^
a.cc: At global scope:
a.cc:53:2: error: expected ';' after class definition
   53 | }
      |  ^
      |  ;
a.cc: In member function 'void Solve::solve()':
a.cc:19:17: error: 'Scanner' was not declared in this scope
   19 |                 Scanner in = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:21:23: error: 'in' was not declared in this scope; did you mean 'int'?
   21 |                 while(in.hasNext()){
      |                       ^~
      |                       int
a.cc:22:25: error: 'String' was not declared in this scope
   22 |                         String s = in.nextLine();
      |                         ^~~~~~
a.cc:24:25: error: 'boolean' was not declared in this scope; did you mean 'bool'?
   24 |                         boolean flag = true;
      |                         ^~~~~~~
      |                         bool
a.cc:25:25: error: 'Stack' was not declared in this scope
   25 |                         Stack<Integer> st = new Stack<Integer>();
      |                         ^~~~~
a.cc:25:31: error: 'Integer' was not declared in this scope
   25 |                         Stack<Integer> st = new Stack<Integer>();
      |                               ^~~~~~~
a.cc:25:40: error: 'st' was not declared in this scope; did you mean 'std'?
   25 |                         Stack<Integer> st = new Stack<Integer>();
      |                                        ^~
      |                                        std
a.cc:25:49: error: 'Stack' does not name a type
   25 |                         Stack<Integer> st = new Stack<Integer>();
      |                                                 ^~~~~
a.cc:25:64: error: expected primary-expression before ')' token
   25 |                         Stack<Integer> st = new Stack<Integer>();
      |                                                                ^
a.cc:27:28: error: 's' was not declared in this scope
   27 |                         if(s.equals(".")) break;
      |                            ^
a.cc:29:44: error: 's' was not declared in this scope
   29 |                         for(int i = 0; i < s.length(); i++){
      |                                            ^
a.cc:34:49: error: 'flag' was not declared in this scope
   34 |                                                 flag =false;
      |                                                 ^~~~
a.cc:40:49: error: 'flag' was not declared in this scope
   40 |                                                 flag = false;
      |                                                 ^~~~
a.cc:46:28: error: 'flag' was not declared in this scope
   46 |                         if(flag) System.out.println("yes");
      |                            ^~~~
a.cc:46:34: error: 'System' was not declared in this scope
   46 |                         if(flag) System.out.println("yes");
      |                                  ^~~~~~
a.cc:47:30: error: 'System' was not declared in this scope
   47 |                         else System.out.println("no");
      |                              ^~~~~~