stiansjogren icon

Untitled

stiansjogren | PRO | 10/10/14 12:21:55 PM UTC | 0 ⭐ | 830 👁️ | Never ⏰ | []
text |

1.15 KB

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <vector>
#include <sstream>
#include <cstdlib>
#include "ctype.h"
using namespace std;
void *sorter(std::vector<char>numb, std::vector<char>letr);
bool isChar(char a);
 int main() {
     std::vector<char>letr;
    std::vector<int> numb;
    std::stringstream ss;
    std::string s;
    bool l =0;
    char b;
    int cnt=0;
    while (getline(cin,s)){
        std::stringstream ss(s);
        char a;
        while(ss >> a){
             if(isalpha(a)==1024){
                letr.push_back(a);
		l=1;
		b=a;
            }
            else if (isdigit(a)==1){
                numb.push_back(a);
		letr.push_back(b);
            }
            else{
                //cout << a << endl;
             }
         }        
    cout << endl;    
}
     for( std::vector<char>::iterator i = letr.begin(); i != letr.end(); ++i){
        std::cout << *i << ' ';
    }
     for (int k=0;k!=numb.size();k++){
        numb[k]= numb[k]-48;
     }
     for(std::vector <int>::iterator j=numb.begin(); j!= numb.end();j++){
        std::cout << *j << ' ';
    }
 return 0;
 }

Comments