Reading an unknown number of data

To read an unknown number of data in C++, use the following loop: while(cin >> a) { // work with number a } This write method reads all the data up to the end of the file. 

In Python, you can read all the data from one line into an array at once. A = list(map(int, input().split()))