CSES - Datatähti 2020 alku - Results
Submission details
Task:Merkkijonot
Sender:Swarm
Submission time:2019-10-08 18:05:55 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:24:13: error: 'strlen' is not a member of 'std'
    if (std::strlen(v[i]) != std::strlen(v[j]))
             ^~~~~~
input/code.cpp:24:13: note: suggested alternative:
In file included from input/code.cpp:2:0:
/usr/include/string.h:384:15: note:   'strlen'
 extern size_t strlen (const char *__s)
               ^~~~~~
input/code.cpp:24:34: error: 'strlen' is not a member of 'std'
    if (std::strlen(v[i]) != std::strlen(v[j]))
                                  ^~~~~~
input/code.cpp:24:34: note: suggested alternative:
In file included from input/code.cpp:2:0:
/usr/include/string.h:384:15: note:   'strlen'
 extern size_t strlen (const char *__s)
               ^~~~~~
input/code.cpp:27:29: error: 'strlen' is not a member of 'std'
    for (int k = 0; k < std::strlen(v[i]); k++)
                             ^~~~~~
input/code.cpp:27:29: note: suggested alternative:
In file included from input/code.cpp:2:0:
/usr/include/string.h:384:15...

Code

#include<iostream>
#include<string.h>
int main()
{
int n;
std::cin >> n;
char v[100000][50];
for (int i = 0; i < n; i++)
{
scanf("%50s", v[i]);
}
int count = 0;
bool b;
for (int i = 0; i < n; i++)
{
for (int j = i+1; j < n; j++)
{
b = true;
if (std::strlen(v[i]) != std::strlen(v[j]))
b = false;
for (int k = 0; k < std::strlen(v[i]); k++)
{
for (int l = k + 1; l < std::strlen(v[i]); l++)
{
if ((v[i][k] == v[i][l]) != (v[j][k] == v[j][l]))
b = false;
}
}
count += b;
}
}
std::cout << count;
return 0;
}