- 取石子
字符计数
- 2025-7-12 14:56:19 @
#include<bits/stdc++.h>
using namespace std;
int t[1005];
int main(){
string s;
cin>>s;
for(int i=0;i<s.size();i++){
t[s[i]]++;
}
for(int i=0;i<=130;i++){
if(i>='0' and i<='9' and t[i]!=0){
cout<<char(i)<<" ";
}else if(i>='A' and i<='Z' and t[i]!=0){
cout<<char(i)<<" ";
}else if(i>='a' and i<='z' and t[i]!=0){
cout<<char(i)<<" ";
}
}
cout<<"\n";
for(int i=0;i<=130;i++){
if(i>='0' and i<='9' and t[i]!=0){
cout<<t[i]<<" ";
}else if(i>='A' and i<='Z' and t[i]!=0){
cout<<t[i]<<" ";
}else if(i>='a' and i<='z' and t[i]!=0){
cout<<t[i]<<" ";
}
}
}
0 条评论
目前还没有评论...
信息
- ID
- 116
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 56
- 已通过
- 9
- 上传者