Skip to content

Instantly share code, notes, and snippets.

@ernestognw
Last active November 16, 2018 18:34
Show Gist options
  • Save ernestognw/fa8657f11b34cd2ef1255538f662b23f to your computer and use it in GitHub Desktop.
Save ernestognw/fa8657f11b34cd2ef1255538f662b23f to your computer and use it in GitHub Desktop.
// eliminaPrimUltPal
// Ernesto García A00820783
// Creado en Tue Nov 13 11:06:23 CST 2018
#include<iostream>
#include<string>
using namespace std;
int main() {
// Declarar variables
string word;
int firstSpace, lastSpace;
getline(cin, word);
// Desarrollo de tu programa
firstSpace = word.find(" ");
word.erase(0, firstSpace + 1);
for (int i = 0; i < word.length(); i++){
if(word[i] == ' '){
lastSpace = i;
}
}
word.erase(lastSpace, word.length()-1);
cout << word << endl;
// Termina el programa
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment