using System;

interface IReversableC : IReversable, System.IComparable
{
}


class TextPassage : IReversableC
{
    public string text;
    bool reversed;

    public TextPassage()
    {
        text = "RELIEFPFEILER";
        Reversed = false;
    }

    public TextPassage(string s)
    {
        text = s;
        Reversed = false;
    }

    public bool Reversed
    {
        get { return reversed; }
        set { reversed = value; }
    }

    public object Reverse()
    {

        string tmp = "";
        string old = String.Copy(text);
        int i;

        // String umkehren
        for (i = 0; i < text.Length; ++i)
        {
            tmp = tmp.Insert(0, text[i].ToString());
        }
        text = String.Copy(tmp);
        Reversed = !Reversed;

        // Original zurückliefern
        return new TextPassage(old);
    }

    // Methoden von IComparable implementieren
    public int CompareTo(object obj)
    {
        TextPassage tp = (TextPassage)obj;
        return String.Compare(this.text, tp.text);
    }


}


class Program
{
    static bool Palindrom(IReversableC obj)
    {
        IReversableC objReverse = (IReversableC)obj.Reverse();

        if (objReverse.CompareTo(obj) == 0)
        {
            Console.WriteLine("\n Palindrom!\n");
            return true;
        }
        else
        {
            Console.WriteLine("\n Kein Palindrom!\n");
            return false;
        }
    }

    static void Main(string[] args)
    {
        TextPassage oText = new TextPassage();

        Console.WriteLine();
        Console.Write(" Geben Sie einen Text ein: ");

        oText.text = (Console.ReadLine().Trim());

        Palindrom((IReversableC)oText);
    }
}

