bishi
{
    class stack
    {
        
private int p_index;
        
private ArrayList list;
        
public stack()
        {
            p_index 
= -1;
            list 
= null;
        }

        
public object pop(object item)
        {
            
object topItem = list[p_index];
            list.Remove(topItem);
            p_index
--;
            
return topItem;
        }

        
public void Push(object item)
        {
            list.Add(item);
            p_index
++;
        }

        
public int count()
        {
            
if (p_index < 0)
                
return 0;
            
else
                
return p_index;
        }

        
static void Main()
        {
            stack myStack 
= new stack();
            stack othStack
=new stack();
            
string myString = "sees";
            
bool isRerverse;
            
int pos=0;
            
for (int x; x < myString.Length; x++)
                myStack.Push(myString.Substring(x,
1));
            
while (myStack.count() > 0)
            {
                
string ch = myStack.pop().ToString();
                
if (ch != myString.Substring(pos, 1))
                {
                    isRerverse 
= false;
                    
break;
                }
                pos
++;
            }
        }
    }
}

相关文章: