---
# System prepended metadata

title: 13711 - Valid String
tags: [loop]

---

# 13711 - Valid String

>author: Utin
###### tags: `loop`

---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    for(int t = 0; t < n; t++) {
        char s[100001];
        scanf("%s", s);
        int l = 0, r = 0, i = 0, hoho = 0;
        while(s[i] != '\0') {
            if(s[i] == '(') l += 1;
            else r += 1;
            if(l < r) {
                hoho = 1;
                break;
            }
            i++;
        }
        if(l != r) hoho = 1;
        if(hoho == 1) printf("No\n");
        else printf("Yes\n");
    }
}
// By Utin
```

## Reference