'commit'
This commit is contained in:
34
TangDou/XiTi/1286.cpp
Normal file
34
TangDou/XiTi/1286.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
//输入+输出重定向
|
||||
freopen("../count.in", "r", stdin);
|
||||
freopen("../count.out", "w", stdout);
|
||||
|
||||
vector<int> v1;
|
||||
int big = 0, small = 0, num = 0, spe = 0;//大写,小写,数字,特殊字符
|
||||
char str[1001];
|
||||
cin >> str;
|
||||
|
||||
for (int i = 0; i < 10001; i++) {
|
||||
if (str[i] == '\0') break;
|
||||
if (str[i] >= 'A' && str[i] <= 'Z') big++;
|
||||
else if (str[i] >= 'a' && str[i] <= 'z') small++;
|
||||
else if (str[i] >= '0' && str[i] <= '9') num++;
|
||||
else spe++;
|
||||
}
|
||||
v1.push_back(big);
|
||||
v1.push_back(small);
|
||||
v1.push_back(num);
|
||||
v1.push_back(spe);
|
||||
//排序
|
||||
sort(v1.begin(), v1.end());
|
||||
//输出最大减最小
|
||||
cout << v1[3] - v1[0] << endl;
|
||||
//关闭文件
|
||||
fclose(stdin);
|
||||
fclose(stdout);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user