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