simple bfs || c++
\n    string findLexSmallestString(string str, int a, int b) {\n        queue<string> q;\n        unordered_set<string> s;\n        q.push(str);    \n        in
```\n    string findLexSmallestString(string str, int a, int b) {\n        queue<string> q;\n        unordered_set<string> s;\n        q.push(str);    \n        int n=str.length();\n        string ans=str;\n        while(!q.empty()){\n            string cur=q.front();\n            q.pop();\n            if(s.count(cur))\n                continue;\n            ans=min(ans, cur);\n            s.insert(cur);\n            string as=cur;\n            for(int i=1; i<n; i+=2)\n                as[i]=\'0\'+(as[i]-\'0\'+a)%10;\n            q.push(as);\n            q.push(cur.substr(n-b,b)+cur.substr(0,n-b));\n        }\n        return ans;\n    }\n```
['Breadth-First Search']