编程介的小学生 2019-05-02 21:27 采纳率: 20.5%
浏览 403

字符串中文的处理,利用C语言的字符串数组的一个代码实现的方式的问题

Problem Description
Garfield enjoys learns idioms very much. There is an interesting kind of idiom of chinese, and we call it ”歇后语". Garfield has a list of this idioms, but the format is awful. Garfield is not very smart, you should use the program to help him to tidy up the idioms.
The standard formt of an idiom here is “A——B”, for example, “王婆卖瓜——自卖自夸". But now there are three awful situations you need to deal with:
1)sometimes there is a pair of chinese brackets in the expression to explain something, and you need to omit the brackets and contexts between them. For example, “麦场上挂马灯——照常(场)".

2)sometimes there are several Bs for the unique A, and two Bs are separated by chinese semicolons. You need to slip the idiom, for each B. For example, “麻布手中绣牡丹——配不上;不配".

3)sometimes the dash between A and B is took place by chinese comma, and you need to change them into dash. For example, “泥菩萨过河,自身难保".

But sometimes both the dash and the comma exit in the idiom, then we define it that the dash is just the separator for A and B.

Input
There is a integer N(1<N<10000) indicating the number of the list to deal. Then N lines follows, each line contain an idiom, and the length of every idiom isn’t beyond 200.

Output
Int first line, output the number of the list you get. Then put the result you calculate. You should sort the list according to the length of idioms, then the lexicographical places.

Hint
中间用到的标点符号,可以在题目中或者输入数据中复制

Sample Input
4
王婆卖瓜——自卖自夸
麦场上挂马灯——照常(场)
麻布手中绣牡丹——配不上;不配
泥菩萨过河,自身难保

Sample Output
5
麦场上挂马灯——照常
王婆卖瓜——自卖自夸
麻布手中绣牡丹——不配
泥菩萨过河——自身难保
麻布手中绣牡丹——配不上

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的