#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
int numbers;
map <int, int> carry;
vector <int> sequence;
while(cin >> numbers){
if(carry.count(numbers) == 0)carry[numbers] = 1, sequence.push_back(numbers);
else carry[numbers] += 1;
}
int l = sequence.size();
for(int i = 0; i < l; i++)cout << sequence[i] << " " << carry[sequence[i]] << endl;
return 0;
}
#include <vector>
#include <map>
using namespace std;
int main(){
int numbers;
map <int, int> carry;
vector <int> sequence;
while(cin >> numbers){
if(carry.count(numbers) == 0)carry[numbers] = 1, sequence.push_back(numbers);
else carry[numbers] += 1;
}
int l = sequence.size();
for(int i = 0; i < l; i++)cout << sequence[i] << " " << carry[sequence[i]] << endl;
return 0;
}
No comments:
Post a Comment