String (String value) { int counter = 0; int index = 0; loop: while (index < value.length()) { switch (value.charAt(index)) { case '<' -> counter++; case '>' -> counter--; case '.' -> { if (counter == 0) { break loop; } } } index++; } return value.substring(0, index); }