replace getchar with getline