```
class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
vector<string> result;
int i = 0;
while( i < nums.size() )
{
int left = nums[ i ];
stringstream ss;
ss << left;
int j = 1;
for( i++; i < nums.size(); i++ )
{
if( left != nums[ i ] - j )
break;
j++;
}
if( j != 1 )
ss << "->" << nums[ i - 1 ];
string temp;
ss >> temp;
result.push_back( temp );
}
return result;
}
};
```