Submission #3007468
Source Code Expand
import java.util.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; public class Main{ static final long mod=1000000007; public static void main(String[] args) throws Exception, IOException{ Reader sc = new Reader(System.in); PrintWriter out=new PrintWriter(System.out); // int n=sc.nextInt(); // char c[][] = new char[h][w]; // char c[]=sc.nextString().toCharArray(); // for(int i=0; i<n; i++) {d[i]=sc.nextInt();} int n=sc.nextInt(); int d[][]=new int[n][26]; for (int i=0; i<n; i++) { char c[] = sc.nextString().toCharArray(); for (int t=0; t<c.length; t++) { d[i][c[t]-'a']++; } } String s=""; for (int i=0; i<26; i++) { int min=100; for (int t=0; t<n; t++) { min=min(d[t][i], min); } for (int t=0; t<min; t++) { s+=(char)('a'+i); } } out.println(s); out.flush(); } static void db(Object... os){ System.err.println(Arrays.deepToString(os)); } } class P implements Comparable<P>{ int id, d; P(int id, int d) { this.id=id; this.d=d; } public int compareTo(P p){ return d-p.d; //des } } class Reader { private BufferedReader x; private StringTokenizer st; public Reader(InputStream in) { x = new BufferedReader(new InputStreamReader(in)); st = null; } public String nextString() throws IOException { while( st==null || !st.hasMoreTokens() ) st = new StringTokenizer(x.readLine()); return st.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(nextString()); } public long nextLong() throws IOException { return Long.parseLong(nextString()); } public double nextDouble() throws IOException { return Double.parseDouble(nextString()); } }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document |
User | mukku |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 2224 Byte |
Status | AC |
Exec Time | 80 ms |
Memory | 21076 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 69 ms | 19284 KB |
0_001.txt | AC | 71 ms | 18772 KB |
dec_half.txt | AC | 70 ms | 17492 KB |
hand.txt | AC | 70 ms | 17620 KB |
max.txt | AC | 80 ms | 18260 KB |
max_10.txt | AC | 71 ms | 16084 KB |
max_5.txt | AC | 80 ms | 18388 KB |
maxx.txt | AC | 72 ms | 19924 KB |
rnd.txt | AC | 68 ms | 17620 KB |
single.txt | AC | 69 ms | 21076 KB |