#include "stdafx.h"
#include "string.h"
int main()
{
char s[100] = { 0 }, t[100][100] = { 0 };
int i, j = 0, k = 0, len , maxlen=0, count = 1;
gets_s(s, sizeof(s));
len = strlen(s);
for (i = 0; i < len; i++)
{
if (s[i] >= 'a'&&s[i] <= 'z')
{
t[j][k++] = s[i]-'a'+'A';
}
else if (s[i] >= 'A'&&s[i] <= 'Z')
{
t[j][k++] = s[i];
}
else
{
j++;
k = 0;
}
}
for (i = 0; i < j; i++)
{
for (k = i + 1; k < j; k++)
{
if (strcmp(t[i], t[k]) == 0)
{
count++;
memset(t[k], 0, sizeof(t[k]));
len = strlen(t[i]);
if (len > maxlen)
{
maxlen = len;
}
}
}
if (t[i][0]!= 0)
{
len = strlen(t[i]);
for (k = 0; k < maxlen - len; k++)
printf(" ");
printf("%s:", t[i]);
for (k = 0; k < count; k++)
printf("*");
printf("%d\n", count);
}
count = 1;
}
return 0;
}
0.0分
0 人评分
printf基础练习2 (C语言代码)浏览:605 |
【亲和数】 (C语言代码)浏览:908 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:2098 |
C语言训练-大、小写问题 (C语言代码)浏览:792 |
WU-图形输出 (C++代码)浏览:836 |
wu-理财计划 (C++代码)浏览:907 |
WU-陶陶摘苹果2 (C++代码)浏览:1018 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:2121 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:750 |
蓝桥杯历届试题-翻硬币 (C++代码)浏览:953 |