memory problem solved. no need to use getline().