<p>Convert a non-negative integer <code>num</code> to its English words representation.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> num = 123
<strong>Output:</strong> &quot;One Hundred Twenty Three&quot;
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> num = 12345
<strong>Output:</strong> &quot;Twelve Thousand Three Hundred Forty Five&quot;
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> num = 1234567
<strong>Output:</strong> &quot;One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven&quot;
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= num &lt;= 2<sup>31</sup> - 1</code></li>
</ul>

class Solution {
public:
    string numberToWords(int num) {
       if(num==0)return "Zero";
        map<int,string>p;
       
        p[1]="One ";
        p[2]="Two ";
        p[3]="Three ";
        p[4]="Four ";
        p[5]="Five ";
        p[6]="Six ";
        p[7]="Seven ";
        p[8]="Eight ";
        p[9]="Nine ";
        p[10]="Ten ";
        p[11]="Eleven ";
        p[12]="Twelve ";
        p[13]="Thirteen ";
        p[14]="Fourteen ";
        p[15]="Fifteen ";
        p[16]="Sixteen ";
        p[17]="Seventeen ";
        p[18]="Eighteen ";
        p[19]="Nineteen ";
        p[20]="Twenty ";
        p[30]="Thirty ";
        p[40]="Forty ";
        p[50]="Fifty ";
        p[60]="Sixty ";
        p[70]="Seventy ";
        p[80]="Eighty ";
        p[90]="Ninety ";
        p[100]="One Hundred ";
        
        if(p.find(num)!=p.end())
        {
            string res=p[num];
            res.pop_back();
            return res;
        }
        int place=0;
        string res="";
        int billion=num/1000000000;
        if(billion>0)
        res=p[(billion%100)%10]+"Billion ";
        cout<<res<<"\n";
        int million=(num%1000000000)/1000000;
         int mh=million;
        if(mh>0 and p.find(mh)!=p.end())
        {
             res+=p[mh]+"Million ";
             million=-1;
        }
        if(million>0)
        res+=(p.count(million/100)?(p[million/100]+"Hundred "):"")+(p.count(million%100)?p[million%100]:
        (p[((million%100)/10)*10]+p[(million%100)%10]))+"Million ";
         
        int thousands=((num%1000000000)%1000000)/1000;
        int th=thousands;
        // if(th>0 and p.find(th)!=p.end())
        // {
        //      res+=p[thousands]+"Thousand ";
        //      thousands=-1;
        // }
       
        // cout<<thousands<<"\n";
        if(thousands>0)
         res+=(p.count(thousands/100)?(p[thousands/100]+"Hundred "):"")+(p.count(thousands%100)?p[thousands%100]:(p[((thousands%100)/10)*10]+p[(thousands%100)%10]))+"Thousand ";
         
      //   p[((thousands%100)/10)*10]+p[(thousands%100)%10]+"Thousand ";
         int hundreds=(((num%1000000000)%1000000)%1000);
         if(hundreds>0)
         {

           int x=hundreds/100;
           if(x>0)
           {
            res+=p[hundreds/100]+"Hundred ";
           }
          res+=(p.count(hundreds%100)?p[hundreds%100]:(p[((hundreds%100)/10)*10]+p[(hundreds%100)%10]));
           }
         
          res.pop_back();
        return res;

    }
};
13700