String
CheatSheet
always remember to take care of an empty string.
Substring constructor
int begin, length; sub_string = s.substr(begin, length);
Reverse a string
sort(string.begin(), string.begin()+length);
- Note the char stuff
string s; char c = s[i]; // it is wrong to write c == " " if ( c == ' ' ) cout << "It is a space.\n" << endl;