█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 2298

Problema 0x5c - Decir si hay una letra repetida

  • Autor: Rafael
  • Fecha: 2020-12-13 00:35:03 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#2
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#3
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#4
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#5
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#6
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#7
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#8
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#9
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#10
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#11
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
#12
Error de compilación
                      main.cpp:10:26: error: no member named 'lenght' in 'std::__cxx11::basic_string<char>'; did you mean 'length'?
  for (int i = 0; i < in.lenght(); i++) {
                         ^~~~~~
                         length
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:936:7: note: 'length' declared here
      length() const _GLIBCXX_NOEXCEPT
      ^
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>

using namespace std;

int main() {
  string in;
  cin >> in;
  vector<int> reg(26);
  bool flag = false;
  for (int i = 0; i < in.lenght(); i++) {
    if (reg[in[i] - 'a']) {
      flag = true;
      break;
    }
    reg[in[i] - 'a']++;
  }
  return 0;
}