package ru.pravvich.additionalQuestion;

class CorrectBracket {

    // сложный если учитывать свякие вложенные в вложенные и тд
    boolean checkSecond(String bracket) {
        String[] arr = bracket.split("");
        if (arr.length % 2 != 0)
            return false;

        for (int i = 0; i < arr.length; i++) {
            if (arr[i] != null && arr[i].equals("(")) {
                for (int j = i + 1; j < arr.length; j++) {
                    if (arr[j] != null && arr[j].equals(")")) {
                        arr[i] = null;
                        arr[j] = null;
                        break;
                    }
                }
            }
        }

        for (String item : arr) {
            if (item != null)
                return false;
        }
        return true;
    }
}

@@ -66,67 +66,203 @@
     
-// %D1%81%D0%BB%D0%BE%D0%B6%D0%BD%D1%8B%D0%B9 %D0%B5%D1%81%D0%BB%D0%B8 %D1%83%D1%87%D0%B8%D1%82%D1%8B%D0%B2%D0%B0%D1%82%D1%8C %D1%81%D0%B2%D1%8F%D0%BA%D0%B8%D0%B5 %D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5 %D0%B2 %D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5 %D0%B8 %D1%82%D0%B4
+public static void main(String%5B%5D args) %7B%0A        String s = %22()()%22;%0A        CorrectBracket correctBracket = new CorrectBracket();%0A        System.out.println(correctBracket.checkSecond(s));%0A    %7D%0A
 %0A   
@@ -312,20 +312,20 @@
     
-String
+char
 %5B%5D arr
+ay
  = b
@@ -335,19 +335,24 @@
 ket.
-split(%22%22
+toCharArray(
 );%0A
+%0A
     
@@ -362,16 +362,18 @@
  if (arr
+ay
 .length 
@@ -436,24 +436,26 @@
 = 0; i %3C arr
+ay
 .length; i++
@@ -481,41 +481,20 @@
 (arr
+ay
 %5Bi%5D 
-!= null && arr%5Bi%5D.equals(%22(%22)
+== '('
 ) %7B%0A
@@ -536,16 +536,18 @@
  j %3C arr
+ay
 .length;
@@ -585,41 +585,20 @@
 (arr
+ay
 %5Bj%5D 
-!= null && arr%5Bj%5D.equals(%22)%22)
+== ')'
 ) %7B%0A
@@ -628,18 +628,19 @@
  arr
+ay
 %5Bi%5D = 
-null
+'+'
 ;%0A  
@@ -668,18 +668,19 @@
  arr
+ay
 %5Bj%5D = 
-null
+'+'
 ;%0A  
@@ -790,25 +790,22 @@
 or (
-String item
+char c
  : arr
+ay
 ) %7B%0A
@@ -824,20 +824,16 @@
 if (
-item != null
+c != '+'
 )%0A  

replace String[]arr to char[]array