An easy understanding way to solve it
but maybe with more timewaste.haha\n\n    class LVP{\n    \n    \tpublic:\n    \tint lvp( string s ){\n    \t\tint len = s.size();\n    \t\tif( !len )\t\t\t// i
but maybe with more timewaste.haha\n\n    class LVP{\n    \n    \tpublic:\n    \tint lvp( string s ){\n    \t\tint len = s.size();\n    \t\tif( !len )\t\t\t// if string is empty, return 0 instantly.\n    \t\t\treturn 0;\n    \t\tfor( int i = 0;i < len;i++ )\t\n    \t\t\tif( s[i] == ')' )\t\n    \t\t\t\tfor( int j = i - 1;j >= 0;j-- )\t\t// for every ')\u2019\uff0cfind the first match '(' before it\n    \t\t\t\t\tif( s[j] == '(' )\t{\t\t\t// and mark the two with a special flag,like '0'\n    \t\t\t\t\t\ts[i] = '0';\n    \t\t\t\t\t\ts[j] = '0';\n    \t\t\t\t\t\tbreak;\n    \t\t\t\t\t}\n    \t\tint max = 0,temp = 0;\t\t\t\t\t\t\n    \t\tfor( int i = 0;i < len;i++ )\t{\t\t\t// the problem changed to find the longest '0' in the string\n    \t\t\tif( s[i] == '0' )\n    \t\t\t\ttemp++;\n    \t\t\telse\t{\n    \t\t\t\tmax = temp > max ? temp : max;\n    \t\t\t\ttemp = 0;\n    \t\t\t}\n    \t\t}\n    \t\tmax = temp > max ? temp : max;\t\t\t\t// longest '0'sequence may still stored in temp\n    \t\treturn max;\n    \t}\n    };
[]