View Code of Problem 36

#include<stdio.h>

int main() {
	int t;
	scanf_s("%d", &t);
	while (t--) {
		char s[1001];
		scanf_s("%s",s,1001);
		int num[26] = {0};
		int i = 0;
		while (s[i] != '\0') {
			int j = s[i] - 65;
			num[j]++;
			i++;
		}
		for (int i = 0;i < 26;i++) {
			if (num[i] != 0) {
				printf("%d%c", num[i], i + 65);
			}
		}
		printf("\n");
	}
	return 0;

}
/*
Main.c: In function 'main':
Main.c:5:2: warning: implicit declaration of function 'scanf_s' [-Wimplicit-function-declaration]
  scanf_s("%d", &t);
  ^
/tmp/ccdCf9bf.o: In function `main':
Main.c:(.text+0x1d): undefined reference to `scanf_s'
Main.c:(.text+0x40): undefined reference to `scanf_s'
collect2: error: ld returned 1 exit status
*/

Double click to view unformatted code.


Back to problem 36