Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return `true` if the string is valid, and `false` if it's invalid.

This Kata is similar to the [Valid Parentheses](https://www.codewars.com/kata/valid-parentheses) Kata, but introduces new characters: brackets `[]`, and curly braces `{}`. Thanks to `@arnedag` for the idea!

All input strings will be nonempty, and will only consist of parentheses, brackets and curly braces: `()[]{}`. 


### What is considered Valid?

A string of braces is considered valid if all braces are matched with the correct brace.


## Examples

```
"(){}[]"   =>  True
"([{}])"   =>  True
"(}"       =>  False
"[(])"     =>  False
"[({})](]" =>  False
```

Difficulty: introductory

Starter code:

def validBraces(string):
	

Solutions:
def validBraces(string):
    braces = {"(": ")", "[": "]", "{": "}"}
    stack = []
    for character in string:
        if character in braces.keys():
            stack.append(character)
        else:
            if len(stack) == 0 or braces[stack.pop()] != character:
                return False
    return len(stack) == 0  

def validBraces(s):
  while '{}' in s or '()' in s or '[]' in s:
      s=s.replace('{}','')
      s=s.replace('[]','')
      s=s.replace('()','')
  return s==''

def validBraces(s, previous = ''):
  while s != previous: previous, s = s, s.replace('[]','').replace('{}','').replace('()','')
  return not s

BRACES = {"(":")", "{":"}","[":"]"}

def validBraces(string):
  waiting = []
  for l in string:
    if l in BRACES.keys():
      waiting.append(BRACES[l])
    elif not waiting or waiting.pop() != l:
      return False
  return not waiting

def validBraces(string):
    while '()' in string or '{}' in string or '[]' in string:
        string = string.replace('()', '')
        string = string.replace('{}', '')
        string = string.replace('[]', '')
    return False if len(string) != 0 else True

def validBraces(string):    
    while len(string) > 0:        
        if "()" in string:
            string = string.replace("()", "")
        elif "[]" in string:
            string = string.replace("[]", "")
        elif "{}" in string:
            string = string.replace("{}", "")
        else:
            return False
    return True         

def validBraces(string):
    stack = []
    delim = {'(':')', '[':']', '{':'}'}
    for c in string:
        if c in list(delim.keys()): stack.append(c)
        elif c in list(delim.values()):
            if not stack or delim[stack.pop()] != c: return False
    return not stack


def validBraces(s):
    pairs = ['{}', '()', '[]']
    while any(pair in s for pair in pairs):
        for pair in pairs: 
            s = s.replace(pair, "")
    return s == ""

def validBraces(string):

  while '()' in string or '[]' in string or '{}' in string:
       string = string.replace('{}','')
       string = string.replace('()','')
       string = string.replace('[]', '')
  
  return not string


import re

class Stack(object):
    def __init__(self): self._vals = []
    def push(self, i): self._vals.append(i)
    def peek(self): return self._vals[-1] if not self.is_empty() else None
    def pop(self): self._vals.pop()
    def is_empty(self): return len(self._vals) == 0

def validBraces(string):
    openers, closers = list(map(list, ('({[', ')}]')))
    pairs = list(zip(openers, closers))

    s = Stack()
    for char in list(string):
        if char in openers:
            s.push(char)
        elif (char in closers and (s.peek(), char) in pairs):
            s.pop()
    return s.is_empty()