Time complexity doubt

here we used two nested loop how the time complexity is O(n)

@devsinghindra
all element/char is pushed once in a queue and poped once from queue so total operation performed is 2*n thats why time complexity is O(n)