Skip to content

Instantly share code, notes, and snippets.

@Zulqurnain
Created December 22, 2013 17:29
Show Gist options
  • Save Zulqurnain/0322b3e5d723421a23b4 to your computer and use it in GitHub Desktop.
Save Zulqurnain/0322b3e5d723421a23b4 to your computer and use it in GitHub Desktop.
Tokenize the given string by removing special characters.
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cout<<"Enter The String :=:"; getline(cin,s,'\n'); cout<<"\n";
for(int i=0;s[i]!=0;i++){
if((s[i]>=48 && s[i]<=57)||(s[i]>=65 && s[i]<=90)||(s[i]>=97 && s[i]<=122)){
cout<<s[i];
}
else
cout<<"\n";
}
cout<<"\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment