Original title
Code implementation (most of the first brush to see the solution, a small part of self-solving)
int findSubstringInWraproundString(char * p){
int i,charlength = strlen(p),dp[26] = {
0},pre = -2,temp,sum = 0,cur;
for(i=0;i<charlength;i++)
{
temp = p[i] - 97;
if(temp == 1 + pre || temp == pre - 25)
cur++;
else
cur = 1;
dp[temp] = fmax(cur,dp[temp]);
pre = temp;
}
for(i=0;i<26;i++)
sum += dp[i];
return sum;
}