@iamx converting int to long long doesn't improve the efficiency...
@mendo1036 use look up tables(DP)...Don't try to iterate over the entire string every time you try a different character at each index of the string....You should have O(n) complexity to get 100pts.