题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <stdio.h> #include <string.h> int main() { char str[500] = { 0 }; gets(str); int len = strlen(str); for (int i = 0; i < len + 1; i++) { for (int j = i + 1; j < len + 1; j++) { if (str[i] == str[j]) { for (int k = j; k < len + 1; k++) { str[k] = str[k + 1]; } len--; j--; } } } printf("%d\n", len); return 0; }