-
Notifications
You must be signed in to change notification settings - Fork 0
/
a.c
39 lines (29 loc) · 613 Bytes
/
a.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <Windows.h>
#pragma warning(disable : 4996)
char s_g[3001] = { NULL, };
int count_g = 1, j_g;
void Compression()
{
for (int i = 0; s_g[i] != NULL; i = (j_g + 1))
{
for (j_g = i; s_g[j_g] == s_g[j_g + 1]; j_g++)
count_g++;
printf("%c", s_g[i]);
if (count_g != 1)
printf("%d", count_g);
count_g = 1;
}
}
int main()
{
system("title 문자열 압축 (only ENG)");
puts("압축할 문자열 입력(영어만)");
scanf("%[a-z || A-Z]s", s_g);
puts("");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6);
Compression();
puts("\n\n");
system("pause");
return 0;
}