eng
competition

Text Practice Mode

java code trainging

created Feb 27th 2015, 21:16 by OmarAlTamimi


1


Rating

135 words
7 completed
00:00
import java.io.*;
import java.util.*;
 
 
public class Main {
 
    public static void main(String args[]) throws IOException {
              
       Reader.init(System.in);
         
                 
   int n = Reader.nextInt();  
   String [] pho = new String [n];
        for (int i = 0; i < pho.length; i++) {
              pho[i]= Reader.reader.readLine();
             
        }boolean ok = false;
        int c =0;
        for (int i = 0; i < pho[0].length(); i++) {
                    for (int j = 1; j <pho.length; j++) {
                            if(pho[0].charAt(i)!=pho[j].charAt(i)){
                                System.out.println(c);return;
            }
                 
            }c++;
        }
            
         
               }
            
    
     
}
 
 
class Reader {
 
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }
 
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
           
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }
 
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
 
    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
 
}

saving score / loading statistics ...