[ create a new paste ] login | about

Link: http://codepad.org/6Fd8V6z0    [ raw code | output | fork ]

C++, pasted on Jun 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <memory>

using namespace std;

int main()
{
    int stat[256];
    memset(&stat[0], 0, sizeof(int) * 256);
    char s[200] = "aabb2222ccc";
    char *p = &s[0];
    while (*p != '\0')
    {
        stat[(int)*p]++;
        p++;
    }
    for (char i = 'a'; i <= 'z'; i++)
        if (stat[(int)i] != 0) cout << i << stat[(int)i];
    cout << endl;
    return 0;
}


Output:
1
a2b2c3


Create a new paste based on this one


Comments: