Submission #1689277


Source Code Expand

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

int main(){
	int n;
	cin >> n;
	char alphabets[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
	int alphabets_have_least[26];
	for(int i = 0; i < 26; i++){
		alphabets_have_least[i] = 51;
	}
	for(int i = 0; i < n; i++){
		int alphabets_have[26];
		for(int i = 0; i < 26; i++){
			alphabets_have[i] = 0;
		}
		string text;
		cin >> text;
		for(int j = 0; j < text.size(); j++){
			for(int k = 0; k < 26; k++){
				if(text[j] == alphabets[k]){
					alphabets_have[k]++;
					break;
				}
			}
		}
		for(int j = 0; j < 26; j++){
			alphabets_have_least[j] = min(alphabets_have_least[j], alphabets_have[j]);
		}
	}
	for(int i = 0; i < 26; i++){
		if(alphabets_have_least[i] == 51){
			continue;
		}
		for(int j = 0; j < alphabets_have_least[i]; j++){
			cout << alphabets[i];
		}
	}
	cout << endl;
}

Submission Info

Submission Time
Task C - Dubious Document
User June_boy
Language C++14 (GCC 5.4.1)
Score 300
Code Size 988 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 10
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
dec_half.txt AC 1 ms 256 KB
hand.txt AC 1 ms 256 KB
max.txt AC 1 ms 256 KB
max_10.txt AC 1 ms 256 KB
max_5.txt AC 1 ms 256 KB
maxx.txt AC 1 ms 256 KB
rnd.txt AC 1 ms 256 KB
single.txt AC 1 ms 256 KB