Pergunta de entrevista da empresa Tavant

Write a program for balanced parenthesis and first repetition of character in a string.