> For the complete documentation index, see [llms.txt](https://xtecna.gitbook.io/solucoes-da-beecrowd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xtecna.gitbook.io/solucoes-da-beecrowd/strings/1551-frase-completa.md).

# 1551 - Frase Completa

## Descrição

{% embed url="<https://www.urionlinejudge.com.br/judge/pt/problems/view/1551>" %}

## Solução

Para este problema, você pode usar um conjunto para acrescentar as letras, e apenas as letras, de cada frase e contar quantos elementos tem ao final para definir se a frase é completa, quase completa ou mal elaborada. Caso sua linguagem não tenha suporte a conjuntos, nada que um mapeamento em um vetor de 26 posições usando a [tabela ASCII](/solucoes-da-beecrowd/base-teorica/strings/tabela-ascii.md) não resolva.

{% tabs %}
{% tab title="C99" %}

```c
#include <string.h>
#include <stdio.h>
#include <ctype.h>

int main(){
    char frase[1001];
    int N, diferentes, contagem[26];

    scanf("%d\n", &N);

    for(int k = 0; k < N; ++k){
        memset(contagem, 0, sizeof(contagem));

        scanf("%[^\n]\n", &frase);

        for(int i = 0; i < strlen(frase); ++i){
            if(isalpha(frase[i])){
                contagem[frase[i] - 'a'] = 1;
            }
        }

        diferentes = 0;
        for(int i = 0; i < 26; ++i){
            if(contagem[i]) ++diferentes;
        }

        if(diferentes == 26)        printf("frase completa\n");
        else if(diferentes > 12)    printf("frase quase completa\n");
        else                        printf("frase mal elaborada\n");
    }

    return 0;
}
```

{% endtab %}

{% tab title="C++17" %}

```cpp
#include <iostream>
#include <cctype>
#include <set>

using namespace std;

int main(){
    int N;
    string frase;
    set<char> letras;

    cin >> N;
    cin.ignore();

    for(int k = 0; k < N; ++k){
        letras.clear();

        getline(cin, frase);

        for(int i = 0; i < frase.length(); ++i){
            if(isalpha(frase[i]))   letras.insert(frase[i]);
        }

        if(letras.size() == 26)     cout << "frase completa" << endl;
        else if(letras.size() > 12) cout << "frase quase completa" << endl;
        else                        cout << "frase mal elaborada" << endl;
    }

    return 0;
}
```

{% endtab %}

{% tab title="JavaScript 12.18" %}

```javascript
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

let N = parseInt(lines.shift());

for(let k = 0; k < N; ++k){
    let frase = lines.shift().trim();

    let letras = new Set();

    for(let i = 0; i < frase.length; ++i){
        if(/[a-z]/.test(frase[i]))  letras.add(frase[i]);
    }

    if(letras.size == 26)       console.log("frase completa");
    else if(letras.size > 12)   console.log("frase quase completa");
    else                        console.log("frase mal elaborada");
}
```

{% endtab %}

{% tab title="Python 2.7" %}

```python
N = int(input())

for _ in range(N):
    frase = input().strip()

    letras = set()

    for letra in frase:
        if(letra.isalpha()):
            letras.add(letra)
    
    if(len(letras) == 26):
        print("frase completa")
    elif(len(letras) > 12):
        print("frase quase completa")
    else:
        print("frase mal elaborada")
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://xtecna.gitbook.io/solucoes-da-beecrowd/strings/1551-frase-completa.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.
