Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.

Example 1:

Input: S = "loveleetcode", C = 'e'
Output:

Note:

S string length is in [1, 10000].
C is a single character, and guaranteed to be in string S.
All letters in S and C are lowercase.

```/**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
int calmin(int a,int b)
{
if(a < b)
return a;
else
return b;
}

int calabs(int a,int b)
{
if(a > b)
return a-b;
else
return b-a;
}

int* shortestToChar(char* S, char C, int* returnSize)
{
int len = strlen(S);
*returnSize = len;
int *res = (int *)malloc(sizeof(int) * len);

/*初始化*/
for(int i = 0; i < len;i++)
{
res[i] = INT_MAX;
}

int pos = -len;

for (int i = 0; i < len; ++i)
{
if (S[i] == C)
pos = i;

res[i] = calmin(res[i], calabs(i,pos));
}

for (int i = len - 1; i >= 0; --i)
{
if (S[i] == C)  pos = i;
res[i] = calmin(res[i], calabs(i,pos));
}

return res;
}
```

vector res(n, n);