

# importing Qiskit
from qiskit import IBMQ, BasicAer
#from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, execute

# import basic plot tools
from qiskit.visualization import plot_histogram

s='11'

n = 2*len(str(s))
ckt = QuantumCircuit(n)
barriers = True

ckt.h(range(len(str(s))))
    
# Apply barrier 
ckt.barrier()

# Apply the query function
## 2-qubit oracle for s = 11
ckt.cx(0, len(str(s)) + 0)
ckt.cx(0, len(str(s)) + 1)
ckt.cx(1, len(str(s)) + 0)
ckt.cx(1, len(str(s)) + 1)  

# Apply barrier 
ckt.barrier()

# Apply Hadamard gates to the input register
ckt.h(range(len(str(s))))

# Measure ancilla qubits
ckt.measure_all()


ckt.draw(output='mpl')

