c++ | easy | short
\n\n# Code\n\nclass Solution {\npublic:\n    string findLexSmallestString(string str, int a, int b) {\n        unordered_set<string> seen; \n        queue<strin
\n\n# Code\n```\nclass Solution {\npublic:\n    string findLexSmallestString(string str, int a, int b) {\n        unordered_set<string> seen; \n        queue<string> q;\n        q.push(str);\n        \n        string lex_smallest_string = str;\n        \n        while(q.empty() == false) \n        {\n            string s = q.front();\n            q.pop();\n\n            lex_smallest_string = min(lex_smallest_string , s);\n\n\n            string first_child = apply_operation_1(s , a);\n            if(seen.find(first_child) == seen.end())\n                q.push(first_child) , seen.insert(first_child);\n\n            string second_child = apply_operation_2(s , b);\n            if(seen.find(second_child) == seen.end())\n                q.push(second_child) , seen.insert(second_child);\n        }\n        return lex_smallest_string;\n    }\n    \n    string apply_operation_1(string s , int a)\n    {\n        for(int i = 1 ; i < s.size() ; i += 2)\n            s[i] = (s[i] - \'0\' + a) % 10 + \'0\';\n        return s;\n    }\n    \n    string apply_operation_2(string s , int b)\n    {\n        string res(s.size() , \' \');\n        for(int i = 0 ; i < s.size() ; ++i)\n            res[(i + b) % s.size()] = s[i];\n        return res;\n    }\n};\n\n```
['C++']