C++ | BFS | Easy to understand
\nclass Solution {\npublic:\n    string findLexSmallestString(string s, int a, int b) {\n        queue<string> q;\n        q.push(s);\n        set<string> st;\n
```\nclass Solution {\npublic:\n    string findLexSmallestString(string s, int a, int b) {\n        queue<string> q;\n        q.push(s);\n        set<string> st;\n        string res = q.front();\n        while(!q.empty()){\n            string temp = q.front();\n            res = min(res,temp);\n            q.pop();\n            string add=temp;\n            for(int i=1;i<add.size();i+=2){\n                int x = add[i]-\'0\';\n                x = (x+a)%10;\n                add[i] = x+\'0\';\n            }\n            if(st.find(add)==st.end()){\n                st.insert(add);\n                q.push(add);\n            }\n            string str2 = temp.substr(0,temp.size()-b);\n            string str1 = temp.substr(temp.size()-b);\n            string rotate = str1+str2;\n            if(st.find(rotate)==st.end()){\n                st.insert(rotate);\n                q.push(rotate);\n            }\n        }\n        return res;\n    }\n};\n```
['Breadth-First Search', 'C']