Last active
November 16, 2018 18:34
-
-
Save ernestognw/fa8657f11b34cd2ef1255538f662b23f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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