In English and programming, groups can be made using symbols such as `()` and `{}` that change meaning. However, these groups must be closed in the correct order to maintain correct syntax.

Your job in this kata will be to make a program that checks a string for correct grouping. For instance, the following groups are done correctly:

```
({})
[[]()]
[{()}]
```

The next are done incorrectly:
```
{(})
([]
[])
```

A correct string cannot close groups in the wrong order, open a group but fail to close it, or close a group before it is opened.

Your function will take an input string that may contain any of the symbols `()`, `{}` or `[]` to create groups.

It should return `True` if the string is empty or otherwise grouped correctly, or `False` if it is grouped incorrectly.

Difficulty: introductory

Starter code:

def group_check(s):
	

Solutions:
BRACES = { '(': ')', '[': ']', '{': '}' }

def group_check(s):
    stack = []
    for b in s:
        c = BRACES.get(b)
        if c:
            stack.append(c)
        elif not stack or stack.pop() != b:
            return False
    return not stack

def group_check(s):
    while "{}" in s or "()" in s or "[]" in s:
       s = s.replace("{}","").replace("()","").replace("[]","")
    return not s

def group_check(s):
    while "()" in s or "{}" in s or "[]" in s:
        s = s.replace("()","")
        s = s.replace("{}","")
        s = s.replace("[]","")
    return len(s) == 0

import re

BRACES = '\(\)|{}|\[\]'

def group_check(s):
    while re.search(BRACES, s):
        s = re.sub(BRACES, '', s)
    return s == ''

def group_check(s):
  l = 9223372036854775807
  while(l > len(s)):
    l = len(s)
    s = s.replace('()', '')
    s = s.replace('{}', '')
    s = s.replace('[]', '')
  return len(s) == 0

OPENING = '([{'
CLOSING = dict(['()', '[]', '{}'])

def group_check(s):
    stack = []
    for c in s:
        if c in OPENING:
            stack.append(CLOSING[c])
        else: # closing
            if len(stack) == 0 or c != stack.pop():
                return False
    return len(stack) == 0

parens = dict([')(', '][', '}{'])

def group_check(s):
    stack = []
    for c in s:
        if c in parens:
            if not (stack and parens[c] == stack.pop()):
                return False
        else:
            stack.append(c)
    return not stack

def group_check(s):
  open = ['(', '{', '[']
  closed = [')', '}', ']']
  f = lambda x: True if (open[x] + closed[x]) in s else False
  while f(0) or f(1) or f(2):
    for i in range(3):
      s = s.replace(open[i] + closed[i], '')
  if s == '':
    return True
  else:
    return False

import re


def group_check(brackets):
    while any(pair in brackets for pair in ("{}", "[]", "()")):
        brackets = re.sub(r"{}|\[]|\(\)", "", brackets)
    return not brackets

def group_check(s):
    for e in ['()','{}','[]','{}','()']:
        while e in s: s = s.replace(e,'')
    return not s