#include <iostream>
#include <vector>
#include<algorithm>
#include <queue>
using namespace std;
class Solution {
public:
vector<string> letterCombinations(
string digits)
{
vector<string>_result;
if (digits.size() <
1)
return _result;
vector<string>_zinum = {
"",
"abc",
"def",
"ghi",
"jkl",
"mno",
"pqrs",
"tuv",
"wxzy" };
int _size = digits.size();
_result.push_back(
"");
for (
int i =
0; i < _size; i++)
{
int num = digits[i] -
'1';
if (num <
1 || num >
9)
continue;
std::
string& _str = _zinum[num];
if (_str.empty())
continue;
std::
vector<string > _tempresult;
for (
int j =
0; j < _str.size(); ++j)
{
for (
int k =
0; k<_result.size(); ++k)
{
_tempresult.push_back(_result[k] + _str[j]);
}
}
_result.swap(_tempresult);
}
return _result;
}
};
void main()
{
std::
string _str =
"2";
Solution s1;
vector<string>_nums;
_nums = s1.letterCombinations(_str);
std::
cout <<
"" << endl;
system(
"pause");
}