1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// PotyczkiAlgorytmiczne2019.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <sstream>

//using namespace std;

static int Task2()
{


	return 0;
}

std::vector<std::string> splitString(std::string str, char delimiter) {
	std::vector<std::string> internal;
	std::stringstream ss(str); // Turn the string into a stream.
	std::string tok;

	while (std::getline(ss, tok, delimiter)) {
		internal.push_back(tok);
	}

	return internal;
}


static int Task1()
{
	//std::ifstream infile("input1_1.txt");

	std::string line;

	std::getline(std::cin, line);
	//std::getline(infile, line);

	unsigned int n = atoi(line.c_str());
	//std::getline(infile, line);
	std::getline(std::cin, line);
	std::vector<std::string> vector = splitString(line, ' ');

	std::sort(vector.begin(), vector.end());

	int count5A, count5B, count5C = 0;
	count5A = std::count(vector.begin(), vector.end(), "5A");
	count5B = std::count(vector.begin(), vector.end(), "5B");
	count5C = std::count(vector.begin(), vector.end(), "5C");

	if (count5A >= 2 && count5B >= 2 && count5C >= 2)
	{
		vector.erase(unique(vector.begin(), vector.end()), vector.end());
		int count = vector.size();
		if (count == 15)
		{
			std::cout << "TAK";
			return 0;
		}
	}
	std::cout << "NIE";
	return 0;
}

int main()
{

	Task1();
	//Task2();
	return 0;

}

/*
int main()
{
	//std::ifstream infile("input2.txt");

	//std::string data;
	//std::cin >> data;
	std::string line;
	std::getline(std::cin, line);
	//std::getline(infile, line);
	//std::cout << "Fisrt Line: \n";
	//std::cout << line << "\n";
	unsigned int n, k = 0;
	std::string delimiter = " ";
	size_t pos = 0;
	pos = line.find(delimiter);
	n = std::stoi(line.substr(0, pos));
	line.erase(0, pos + delimiter.length());
	pos = line.find(delimiter);
	k = std::stoi(line.substr(0, pos));
	int result, i, ii = 0;
	for (i = 0; i < n; i++)
	{
		result = 0.5 * ((int)i * (int)(i + 1));
		if (result >= k)
		{
			// std::cout << "line #: " << i << "\n";
			break;
		}
	}

	std::vector<double> vector;
	std::string token = "";
	int minValue = 0;
	while (std::getline(std::cin, line))
	{
		if (ii - 1 == n)
			break;

		if ((i - 1) == ii)
		{

			while (vector.size() < i)
			{
				pos = line.find(delimiter);
				token = line.substr(0, pos);
				vector.push_back(std::stoi(token));
				line.erase(0, pos + delimiter.length());
			}


			minValue = *std::min_element(vector.begin(), vector.end());
			break;
			// process pair (a,b)
		}
		ii++;

		// std::cout << "Hello World!\n";

	}
	std::cout << minValue;

	return 0;

}
*/


// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file