Помогите решить на С++ и Pascal или в чем то одном) Задача Характеристики генома.
Даю 20 баллов!

Приложения:

Ответы

Ответ дал: arseney300
0

#include <iostream> // header input/output streams

#include <string>

using std::string;

#include <map>

using std::map;

using std::cin; // для работы cin

using std::cout; // для работы cout

using std::endl; // для работы перевода на новую строку endl

int main(){

unsigned int n;

  cin >> n;

  string st;

  cin >> st;

  map<char, int> a;

  for (auto i = st.begin(); i<st.end(); ++i){

     try{

       a[*i]++;

     }

     catch(std::exception&e){

       a.insert(std::make_pair(*i,1));

     }

   }

for (auto i = a.begin(); i!=a.end();++i){

    cout << i->first  << ' ' <<  i->second << endl;

   }

}

Вас заинтересует