Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <string>
- using namespace std;
- string task(string str){
- string newstr = "";
- for(int i=0; i<str.length(); i++){
- char symbol = str[i];
- int count=1;
- if(symbol !=' '){
- for(int j=i+1;j<str.length(); j++){
- if(str[j] == symbol){
- str[j] = ' ';
- count++;
- }
- }
- cout<<count<<symbol; // Вместо вывода сделай сбор строки
- //newstr+=count.toStrring() + symbol.toString();
- }
- }
- return newstr;
- }
- int main()
- {
- string str = "NANSANNS";
- task(str);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement