I've tried a bunch of methods listed on here but none of them work. It's always waiting for more input.
I've tried while(std::getline(std::cin, line)) and the method below, nothing seems to work:
#include <iostream>
#include <sstream>
using namespace std;
int main(){
  long length = 1UL<<32;
  int array[length];
  // memset(array, 0, (length-1) * sizeof(int));
  for(int i = 0; i < length; i++)
    array[i] = 0;
  string line;
  int num;
  while(!cin.eof()){
    getline(cin,line);
    stringstream ss(line);
    ss >>num;
    array[num]++;
  }
  for(int i = 0; i < length; i++)
      if(array[i]){
          cout << i << ": ";
          cout << array[i] << endl;
      }
}
 
     
     
     
    