07
19

문제 개요

  • 파일 이름의 길이는 모두 같음
  • 패턴에는 알파펫, . , ?만 넣을 수 있고 가능하면 ?를 적게 써야 함

아이디어

N개에서 다 같은 입력이 들어오면 그 알파벳 출력

하나라도 다른게 있으면 ? 되는거 아님?

→ ㅇㅇ. 브론즈 문제다. 초간단.

코드

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	cin >> n;
	string str_ans;
	string str_input;
	for (int i = 0; i < n; i++) {
		cin >> str_input;
		if (i == 0) {
			str_ans = str_input;
			continue;
		}
		for (int j = 0; j < str_input.length(); j++) {
			if (str_ans[j] != str_input[j]) {
				str_ans[j] = '?';
			}
		}

	}
	cout << str_ans;

	return 0;
}
COMMENT