package ru.redguy.tasks;

import ru.redguy.ATask;
import ru.redguy.Task;

import java.io.IOException;

@ATask("2507")
public class Task2507 extends Task {
    @Override
    public void run() throws IOException {
        String s = getFile("k8.txt");
        int line = 0;
        char lineChar = 'a';
        for (int i = 0; i < s.length(); i++) {
            String sub = s.substring(i);
            int bingo = 0;
            char start = sub.charAt(0);
            for (int j = 0; j < sub.length(); j++) {
                if(sub.charAt(j) == start) {
                    bingo++;
                } else {
                    if(line < bingo) {
                        line = bingo;
                        lineChar = start;
                    }
                    break;
                }
            }
        }
        System.out.println(lineChar + " " + line);
    }
}
