[c++] simple BFS
\nclass Solution {\npublic:\n    \n    string findLexSmallestString(string s, int a, int b) {\n        unordered_set<string> visited;\n        queue<string> q;\
```\nclass Solution {\npublic:\n    \n    string findLexSmallestString(string s, int a, int b) {\n        unordered_set<string> visited;\n        queue<string> q;\n        q.push(s);\n        string ans = s;\n        visited.insert(s);\n        while(!q.empty())\n        {\n             string front = q.front();\n             q.pop();\n             ans=min(ans,front);\n             string addstr = add(front,a), rotatestr = rotate(front,b) ;\n             if(visited.find(addstr)==visited.end()) \n             {\n                visited.insert(addstr);\n                q.push(addstr);\n             }\n             if(visited.find(rotatestr)==visited.end())\n             {\n                visited.insert(rotatestr);\n                q.push(rotatestr);\n             }\n        }\n        return ans;\n    }\n    \n    string add(string s, int a)\n    {\n        for(int i=1;i<s.size();i=i+2)\n        {\n            int x = (s[i]-\'0\'+a)%10;\n            s[i]=\'0\'+x;\n        }\n        return s;\n    }\n    \n    string rotate(string s, int b)\n    {\n        for(int i=0;i<b;i++)\n        {\n            char p = s[s.length()-1];\n            s.pop_back();\n            s.insert(s.begin(), p); \n        }\n        return s;\n    }\n};\n```
[]