getline first 20 character code example Example: getline limit input string text; getline(cin, text); text = text.substr(0, 100);