Use std::vector instead of static array to make the program safier and more flexible