Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- int main() {
- // your code goes here
- string str = " ah na ";
- char space = ' ';
- size_t found = str.find(space);
- while(found!=string::npos){
- if(found==0 || found==str.length()-1){
- int pos =found;
- str.erase(pos, 1);
- }
- found = str.find(space, found+1);
- }
- cout<<str<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment