Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- //[95632;95650]
- public class aas {
- public static void main(String[] args) {
- try{
- FileReader fr = new FileReader("C:/Users/alexa/Downloads/24.txt");
- BufferedReader bf = new BufferedReader(fr);
- String[] s = new String[1000];
- for(int i =0;i<s.length;i++){
- s[i]= bf.readLine();
- }
- int nnow=0,nmin=10000,nminindex=0;
- String[] str;
- for(int i =0;i<s.length;i++){
- nnow=0;
- str=s[i].split("");
- for(int j = 0;j<str.length;j++){
- if(str[j].equals("N")){
- nnow+=1;
- }
- }
- if(nnow<nmin){
- nmin=nnow;
- nminindex=i;
- }
- }
- str=s[nminindex].split("");
- String[] alf = {"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"};
- String mincymb="";
- nmin=1000;
- for(int i=0;i<alf.length;i++){
- nnow=0;
- for(int j=0;j< str.length;j++){
- if(str[j].equals(alf[i])){
- nnow+=1;
- }
- if (nnow<nmin);{
- mincymb=alf[i];
- nmin=nnow;
- }
- }
- }
- System.out.println(mincymb);
- }
- catch(IOException e ){}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment