def feed(input)
      heads, @stack, accept = [@start], [], false
      
      # Move any initial e-transitions
      eTrans = transition(@start, '&') if has_transition?(@start, '&')
      heads += eTrans

      puts "initial heads: #{heads}"
      puts "initial stack: #{@stack}"

      # Iterate through each symbol of input string
      input.each_char do |symbol|
        newHeads = []
        
        puts "Reading symbol: #{symbol}"

        heads.each do |head|
          puts "At head #{head}"

          # Check if head can transition read symbol
          # Head dies if no transition for symbol
          if has_transition?(head, symbol)
            puts "Head #{head} transitions #{symbol}"
            puts "stack: #{@stack}"
            transition(head, symbol).each { |t| newHeads << t }
            puts "heads: #{newHeads}"
            puts "stack: #{@stack}"
          end

        end
        
        heads = newHeads
        break if heads.empty?
      end

      puts "Loop finished"
      
      accept = includes_accept_state? heads

      puts "heads: #{heads}"
      puts "stack: #{stack}"
      puts "accept: #{accept}"

      resp = {
        input: input,
        accept: accept,
        heads: heads,
        stack: stack
      }
    end
def feed(input)
      heads, @stack, accept = [@start], [], false
      
      # Move any initial e-transitions
      eTrans = transition(@start, '&') if has_transition?(@start, '&')
      heads += eTrans

      puts "initial heads: #{heads}"
      puts "initial stack: #{@stack}"

      # Iterate through each symbol of input string
      input.each_char do |symbol|
        newHeads = []
        
        puts "Reading symbol: #{symbol}"

        heads.each do |head|
          puts "At head #{head}"

          # Check if head can transition read symbol
          # Head dies if no transition for symbol
          if has_transition?(head, symbol)
            puts "Head #{head} transitions #{symbol}"
            puts "stack: #{@stack}"
            transition(head, symbol).each { |t| newHeads << t }
            puts "heads: #{newHeads}"
            puts "stack: #{@stack}"
          end

        end
        
        heads = newHeads
        break if heads.empty?
      end

      puts "Loop finished"
      
      accept = includes_accept_state? heads

      puts "heads: #{heads}"
      puts "stack: #{stack}"
      puts "accept: #{accept}"

      resp = {
        input: input,
        accept: accept,
        heads: heads,
        stack: stack
      }
    end
Initialize a PDA object.
 Runs the input on the machine and returns a Hash describing
 the machine's final state after running.

 @param [String] input the string to use as input for the PDA
 @return [Hash] a hash describing the PDA state after running
   * :input [String] the original input string
   * :accept [Boolean] whether or not the PDA accepted the string
   * :heads [Array] the state which the head is currently on