CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:Luukasa
Submission time:2020-09-28 00:26:16 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:34:5: error: 'cont' was not declared in this scope
     cont = true;
     ^~~~
input/code.cpp:34:5: note: suggested alternative: 'uint'
     cont = true;
     ^~~~
     uint

Code

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int n; cin >> n;
	vector<string> sanat;
	string temp;
	for(int i = 0; i < n; i++)
	{
		cin >> temp;
		sort(temp.begin(), temp.end());
		sanat.push_back(temp);
	}
	//for(string c : sanat)
	//	cout << c << '\n';
	// maybe sort each word and then check for letter amounts
	int ans = n;
	for(int i = 0; i < n; i++)
	{
		char prev = ' ';
		for(char c : sanat[i])
		{
			if(prev == ' ')
			{
				prev = c;
				continue;
			}
			if(c==prev)
			{
				cont = true;
				prev = ' ';
				continue;
			}
			else
			{
				ans--;
				break;
			}
		}
	}
	cout << ans << '\n';
	return 0;
}