1141번

seuls2·2023년 4월 26일
0

BOJ

목록 보기
27/55

1141

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool findSame(string a, string b) {
	int sameCnt = 0;
	for (int i = 0; i < a.length(); i++) {
		if (a[i] == b[i]) {
			sameCnt++;
		}
	}
	if (a.length() == sameCnt) return true;
	return false;
}

bool compare(string a, string b) {
	return a.length() < b.length();
}

int main() {
	int n;
	vector<string> words;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string word;
		cin >> word;
		words.push_back(word);
	}

	sort(words.begin(), words.end());

	int cnt = 0;
	for (int i = 0; i < n; i++) {
		string word = words[i];

		int checkPossible = true;
		for (int j = i + 1; j < n; j++) {
			if (i == j) continue;
			if (findSame(word, words[j])) {
				checkPossible = false;
				break;
			}
		}
		if (checkPossible) {
			cnt++;
		}
	}
	cout << cnt;
}
profile
공부 기록용 ( ᵕ·̮ᵕ )♩

0개의 댓글