using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        var X = ReadLine();
        var Y = string.Concat(X.Reverse());
        int N = X.Length;
        int M = 26;
        var cnt = new int[N, M];
        for (int i = 0; i < N; i++)
        {
            for (int k = 0; k < M; k++)
            {
                if (i > 0) cnt[i, k] = cnt[i - 1, k];
            }
            cnt[i, X[i] - 'a']++;
        }

        var C = new int[N, N];
        for (int i = 0; i < N; i++)
        {
            for (int j = i; j < N; j++)
            {
                int tmp = 0;
                for (int k = 0; k < M; k++)
                {
                    var t = cnt[j, k];
                    if (i > 0) t -= cnt[i - 1, k];
                    if (t > 0) tmp++;
                }
                C[i, j] = tmp;
            }
        }
        //WriteLine(C[0, N - 1]);

        var V = new int[N + 1, 26]; //i番目の文字にいるときに、次のjという文字の場所
        for (int i = 0; i < 26; i++)
        {
            V[N, i] = int.MaxValue;
        }
        for (int i = N - 1; i >= 0; i--)
        {
            for (int j = 0; j < 26; j++)
            {
                V[i, j] = V[i + 1, j];
            }
            V[i, X[i] - 'a'] = i + 1;
        }
        var W = new int[N + 1, 26];
        for (int i = 0; i < 26; i++)
        {
            W[N, i] = int.MaxValue;
        }
        for (int i = N - 1; i >= 0; i--)
        {
            for (int j = 0; j < 26; j++)
            {
                W[i, j] = W[i + 1, j];
            }
            W[i, Y[i] - 'a'] = i + 1;
        }

        var dp = new ModInt[N + 1, N + 1];
        dp[0, 0] = 1;
        ModInt ans = 0;

        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                for (int k = 0; k < M; k++)
                {
                    if (V[i, k] == int.MaxValue || W[j, k] == int.MaxValue)
                    {
                        continue;
                    }
                    dp[V[i, k], W[j, k]] += dp[i, j];
                }
                if (i + j <= N)
                {
                    ans += dp[i, j] * (1 + C[i, N - j - 1]);
                    //WriteLine(i + " " + j + " " + dp[i, j] + " " + dp[i, j] * (1 + C[i, N - j - 1]));
                }
            }
        }

        WriteLine(ans - 1);



    }

}

#region ModInt
/// <summary>
/// [0,<see cref="Mod"/>) までの値を取るような数
/// </summary>
public struct ModInt
{
    /// <summary>
    /// 剰余を取る値．
    /// </summary>
    public const long Mod = (int)1e9 + 7;

    /// <summary>
    /// 実際の数値．
    /// </summary>
    public long num;
    /// <summary>
    /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
    /// </summary>
    /// <param name="n">インスタンスが持つ値</param>
    /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
    public ModInt(long n) { num = n; }
    /// <summary>
    /// このインスタンスの数値を文字列に変換します．
    /// </summary>
    /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
    public override string ToString() { return num.ToString(); }
    public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
    public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
    public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
    public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(long v, long k)
    {
        long ret = 1;
        for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
            if ((k & 1) == 1) ret = ret * v % Mod;
        return new ModInt(ret);
    }
    /// <summary>
    /// 与えられた数の逆元を計算します．
    /// </summary>
    /// <param name="v">逆元を取る対象となる数</param>
    /// <returns>逆元となるような値</returns>
    /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
    public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
}
#endregion

#region Binomial Coefficient
public class BinomialCoefficient
{
    public ModInt[] fact, ifact;
    public BinomialCoefficient(int n)
    {
        fact = new ModInt[n + 1];
        ifact = new ModInt[n + 1];
        fact[0] = 1;
        for (int i = 1; i <= n; i++)
            fact[i] = fact[i - 1] * i;
        ifact[n] = ModInt.Inverse(fact[n]);
        for (int i = n - 1; i >= 0; i--)
            ifact[i] = ifact[i + 1] * (i + 1);
        ifact[0] = ifact[1];
    }
    public ModInt this[int n, int r]
    {
        get
        {
            if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
            return fact[n] * ifact[n - r] * ifact[r];
        }
    }
    public ModInt RepeatedCombination(int n, int k)
    {
        if (k == 0) return 1;
        return this[n + k - 1, k];
    }
}
#endregion
class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
    public string join<T>(IEnumerable<T> values) { return string.Join(" ", values); }
}


Measured memory_bytes: 65244