# Duplicates in a String

```c
void findDuplicates(char a[]) {

    // Considering all characters to be lowercase
    // Range : 97 to 122 => Consider 97 as 0 and 122 as 25

    // Hash array
    int h[26] = {0};

    // Store count of each alphabet in hash array
    for (int i = 0; a[i] != '\0'; i++) {
        h[a[i] - 97]++;
    }

    // Displaying duplicates
    for (int i = 0; i < 26; i++) {
        if (h[i] > 1) {
            printf("Duplicate found : %c\n", i+97);
        }
    } 
    
}
```

Contributed by Nitin Ranganath


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nitinranganath.gitbook.io/data-structures/strings/duplicates-in-a-string.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
