class Solution {
public:
char a[10][5]={{'\0'},{'\0'},{'a','b','c'},{'d','e','f'},{'g','h','i'},{'j','k','l'},{'m','n','o'},{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};
vector<string> ans;
vector<string> letterCombinations(string digits) {
if(digits.length()==0)
return ans;
fun(digits,0,"");
return ans;
}
void fun(string digits,int index,string res)
{
if(index==digits.length())
{
ans.push_back(res);
return;
}
int x = digits[index]-'0';
for(int i=0;i<5;i++)
{
if(a[x][i]=='\0')
break;
fun(digits,index+1,res+a[x][i]);
}
}
};