Balanced parenthesis question

sir it is showing no as output for every case.Pl tell the mistake in the code