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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:24:8: error: 'strlen' was not declared in this scope
    if (strlen(v[i]) != strlen(v[j]))
        ^~~~~~
input/code.cpp:24:8: note: suggested alternative: 'mbrlen'
    if (strlen(v[i]) != strlen(v[j]))
        ^~~~~~
        mbrlen
input/code.cpp:27:24: error: 'strlen' was not declared in this scope
    for (int k = 0; k < strlen(v[i]); k++)
                        ^~~~~~
input/code.cpp:27:24: note: suggested alternative: 'mbrlen'
    for (int k = 0; k < strlen(v[i]); k++)
                        ^~~~~~
                        mbrlen
input/code.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%50s", v[i]);
   ~~~~~^~~~~~~~~~~~~~

Code

#include<iostream>
#include<string>

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 (strlen(v[i]) != strlen(v[j]))
				b = false;

			for (int k = 0; k < strlen(v[i]); k++)
			{
				for (int l = k + 1; l < 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;
}