Computer Science, asked by annudubey80497, 2 months ago

Problem Statement
Curious Shubham (100 Marks)
There are 26 groups of people in Shubham's Company. At lunchtime, they all want to get some food to eat as soon as possible. All the groups have made plan to get some food as soon as possible. According to the plan, every person of the group will share the description of food he/she wants to eat so that all the group members will be able to order the food on the behalf of his/her group. All the persons stand at various locations in the queue and whoever will get the food first, will distribute the food among all the group.

But there is a weird procedure of getting the food from a queue. People having even indices form a new queue and process repeats until only 1 person remains in the queue. He/she will be able to order some food of his choice. Shubham and his friends are curious about the group which will be able to get some food.

Input Format
The first line of input consists of the number of people present in the Queue, N.
The second line of input consists of a string that represents the group of each person who is standing in the queue.


Constraints
1<= N <=25000000

The string consists of uppercase letters only.

Answers

Answered by sudhasingaravelan56
1

Answer:

I don't know what is this I will send the answers

Answered by dreamrob
0

Program in Python:

N = int(input("Enter the number of people present in the queue : "))

if N < 1 or N > 25000000:

   print("Invalid input")

else:

   S = input("Enter the group of each person who is standing in the queue : ")

   if len(S) != N:

       print("Invalid input")

   else:

       while len(S) != 1:

           new = ""

           for ch in range(1, N, 2):

               new = new + S[ch]

           N = (int)(N / 2)

           S = new

   print(S)

       

Output:

Enter the number of people present in the queue : 10

Enter the group of each person who is standing in the queue : GKFXGHMSHQ

S

Similar questions