poj2408 字符串处理,排序

578 篇文章 ¥299.90 ¥399.90
570 篇文章 ¥299.90 ¥399.90
该博客主要探讨了如何处理字符串并进行排序。首先通过读取输入的字符串,将其转化为小写并排序,然后使用自定义排序函数对字符串数组进行排序。接着,将相同字符串归为一组,并按组内元素数量进行再次排序。最后,输出每组中不同字符串及其出现次数。这是一个涉及字符串操作、排序算法和数据分组的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
struct node{
string a,b;
}a[30005],g[30005];
struct nod{
string a,b;
int n;
}c[30005];
bool Cmp(node a,node b){
return a.a<b.a;}
bool fum(nod a,nod b){
return a.n>b.n;}
bool fu(node a,node b){
    if(a.b==b.b)
        return a.a<b.a;
return a.b<b.b;}
bool fun(nod a,nod b){
    if(a.n==b.n)
        return a.a<b.a;
return a.n>b.n;}
int main(){
   // freopen("1.txt","r",stdin);
int i=0;
string t;
while(cin>>a[i].a){
    t=a[i].a;
    sort(t.begin(),t.end());
    a[i].b=t;
    i++;
}
sort(a,a+i,fu);
int d=0;
c[0].a
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值