// demoString.cpp
// Demonstrates a C++ string class object

#include <iostream>
#include <string>

using namespace std;

int main()
{
   // Announce purpose of program:
   cout << "This program demonstrates a C++ string class object." << endl;

   // Input a string, as a C++ string class object:
   cout << "Enter a word at least 3 characters long:>";
   string word;    // to be input from user
   cin >> word;

   // Output string, and then output its length, then
   // the first three characters and the last character:
   cout << "You typed: " << word << endl;
   cout << "Your word is " << word.length()
        << " characters long." << endl;
   cout << "The first three characters in your word are: "
        << word[0] << word[1] << word[2] << endl;
   cout << "The last character in your word is: "
        << word[word.length() - 1] << endl;

   return 0;
}  // function main