@@ -0,0 +1,1568 @@
+import java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0A%0A// https://www.hackerrank.com/challenges/repeated-string/problem%0Apublic class RepeatedString %7B%0A%0A    private static int getRepetitions(String string, char someChar) %7B%0A        int repetitions = 0;%0A        for (char c : string.toCharArray()) %7B%0A            if (c == someChar) %7B%0A                repetitions++;%0A            %7D%0A        %7D%0A        return repetitions;%0A    %7D%0A%0A    private static int getRemainderRepetitions(String string, long limit, char targetChar) %7B%0A        int length = string.length();%0A        int remainder = Math.toIntExact(limit %25 length);%0A        int remainderRepetitions = 0;%0A        if (remainder %3E 0) %7B%0A            String substring = string.substring(0, remainder);%0A            remainderRepetitions = getRepetitions(substring, targetChar);%0A        %7D%0A        return remainderRepetitions;%0A    %7D%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        // Read input%0A        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));%0A        String string = reader.readLine();%0A        long limit = Long.parseLong(reader.readLine());%0A        // Calculate result%0A        char targetChar = 'a';%0A        long repetitions = getRepetitions(string, targetChar);%0A        long times = (limit / string.length());%0A        int remainderRepetitions = getRemainderRepetitions(string, limit, targetChar);%0A        long answer = (repetitions * times) + remainderRepetitions;%0A        // Print result%0A        System.out.println(answer);%0A    %7D%0A%7D%0A

Add solution for Repeated string problem.