View Code of Problem 36

#include<stdio.h>
int main()
{
	int i,j, a, b, c,k,num,x;
	int T;
	char q[10000];
	char p[10000];
	scanf("%d", &T);
	for (i = 0; i < T; i++)
	{
		scanf("%s", q);
		num = 0;
		k = 0;
		x = 0;
		do
		{
			for (j = 0; j < strlen(q); j++)
			{
				if (q[j] == 'A' + k)
				{
					num++;
				}
			}
				if (num != 0)
				{
					p[x] = num + '0'; p[x + 1] = 'A' + k;
					x = x + 2;
				}
			k++;
			num = 0;
		} while (k <= 25);
		p[x] = '\0';
		puts(p);
	}
}

Double click to view unformatted code.


Back to problem 36