Java Solution BFS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String findLexSmallestString(String s, int a, int b) {\n        Queue<String> queue = new ArrayDeque<>();\n        queue.offer(s);\n        Set<String> visited = new HashSet<>();\n        visited.add(s);\n        String result = s;\n        while(!queue.isEmpty()){\n            String current = queue.poll();\n            if(current.compareTo(result) < 0){\n                result = current;\n            }\n            String stringrotate = rotatestring(current, b);\n            String stringadd = addstring(current, a);\n            if(!visited.contains(stringrotate)){\n                visited.add(stringrotate);\n                queue.offer(stringrotate);\n            }\n            if(!visited.contains(stringadd)){\n                visited.add(stringadd);\n                queue.offer(stringadd);\n            }\n        }\n        return result;\n    }\n    private String rotatestring(String s, int b){\n        if(b % s.length() == 0){\n            return s;\n        }\n        int length = b % s.length();\n        char[] array = s.toCharArray();\n        reverse(array, 0, array.length - 1);\n        reverse(array, 0, length - 1);\n        reverse(array, length, array.length - 1);\n        return new String(array);\n    }\n    private void reverse(char[] array, int left, int right){\n        while(left < right){\n            char temp = array[left];\n            array[left] = array[right];\n            array[right] = temp;  \n            left++;\n            right--;          \n        }\n    }\n    private String addstring(String s, int a){\n        char[] array = s.toCharArray();\n        StringBuilder sb = new StringBuilder();\n        for(int i = 0; i < array.length; i++){\n            if(i % 2 == 0){\n                sb.append(array[i]);\n            }\n            else{\n                int num = array[i] - \'0\' + a;\n                int digit = num % 10;\n                String str = "" + digit;\n                sb.append(str);\n            }\n        }\n        return new String(sb);\n    }\n}\n```
['Java']