make this java code faster: package LeetCode.task_3_Longest_Substring_Without_Repeating_Characters;

import java.util.HashSet;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        String input = "hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                "0123456789hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX" +
                "YZ0123456789hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV" +
                "WXYZ0123456789hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST" +
                "UVWXYZ0123456789hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR" +
                "STUVWXYZ0123456789hijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" +
                "QRSTUVWXYZ0123456789"; // 7
        System.out.println(solution(input));
    }

    static int solution(String str) {
        int n = str.length();
        int longest = 0;
        Set<Character> seen = new HashSet<>();

        int left = 0;
        for (int right = 0; right < n; right++) {
            char currentChar = str.charAt(right);
            while (seen.contains(currentChar)) {
                seen.remove(str.charAt(left));
                left++;
            }
            seen.add(currentChar);
            longest = Math.max(longest, right - left + 1);
        }

        return longest;
    }
}
