CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <sstream>
#include <cctype>
#include <cmath>
using namespace std;
// Function to remove punctuation from a string
string removePunctuation(const string& str) {
string cleaned;
for (char c : str) {
if (isalpha(c) || isspace(c)) { // Keep only letters and spaces
cleaned += c;
}
}
return cleaned;
}
int main() {
string input;
// Prompt user for input
cout << "Enter a sentence: ";
if (!getline(cin, input) || input.empty()) {
cout << "No input provided." << endl;
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Ejecutar