Tavant Interview Question

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