//https://www.acmicpc.net/problem/1032 #include <iostream> | |
#include <cstring> | |
using namespace std; | |
int main() | |
{ | |
string str1, str2; | |
int N; | |
cin >> N >> str1; | |
int l=str1.size(); | |
bool chk[51]={1,}; | |
if(N==1) {cout << str1; return 0;} | |
for(int i=1; i<N; i++) | |
{ | |
cin >> str2; | |
for(int j=0; j<=l; j++) | |
if(str1[j]!=str2[j]) chk[j]=0; | |
str1=str2; | |
} | |
for(int i=0; i<l; i++) | |
{ | |
if(chk[i]==1) cout<< str1[i]; | |
else cout << "?"; | |
} | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
171127_4344_평균은 넘겠지 (0) | 2017.11.27 |
---|---|
171127_2743_단어 길이 재기 (0) | 2017.11.27 |
171126_10808_알파벳 개수 (0) | 2017.11.26 |
171126_10809_알파벳 찾기 (0) | 2017.11.26 |
171126_1100_하얀 칸 (0) | 2017.11.26 |
//https://www.acmicpc.net/problem/1032 #include <iostream> | |
#include <cstring> | |
using namespace std; | |
int main() | |
{ | |
string str1, str2; | |
int N; | |
cin >> N >> str1; | |
int l=str1.size(); | |
bool chk[51]={1,}; | |
if(N==1) {cout << str1; return 0;} | |
for(int i=1; i<N; i++) | |
{ | |
cin >> str2; | |
for(int j=0; j<=l; j++) | |
if(str1[j]!=str2[j]) chk[j]=0; | |
str1=str2; | |
} | |
for(int i=0; i<l; i++) | |
{ | |
if(chk[i]==1) cout<< str1[i]; | |
else cout << "?"; | |
} | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
171127_4344_평균은 넘겠지 (0) | 2017.11.27 |
---|---|
171127_2743_단어 길이 재기 (0) | 2017.11.27 |
171126_10808_알파벳 개수 (0) | 2017.11.26 |
171126_10809_알파벳 찾기 (0) | 2017.11.26 |
171126_1100_하얀 칸 (0) | 2017.11.26 |