当前位置:网站首页>HJ字符串排序
HJ字符串排序
2022-06-28 07:36:00 【有勇气的牛排】
描述
给定 n 个字符串,请对 n 个字符串按照字典序排列。
数据范围:1≤n≤1000 ,字符串长度满足1≤len≤100
输入描述:
输入第一行为一个正整数n(1≤n≤1000),下面n行为n个字符串(字符串长度≤100),字符串中只含有大小写字母。
输出描述:
数据输出n行,输出结果为按照字典序排列的字符串。
示例1
输入:9
cap
to
cat
card
two
too
up
boat
boot
输出:boat
boot
cap
card
cat
to
too
two
up
牛客HJ Python
# 输入n、初始化list
n,list =input(),[]
# 输入字符串到list
while True:
try:
list.append(input())
except:
break
# 排序list,并且输出
for i in sorted(list):
print(i)
边栏推荐
- R language drawing ggplot2 seasonal graph
- R 语言 ggmap
- Sword finger offer II 091 Paint the house
- Hash slot of rediscluster cluster cluster implementation principle
- 安全培训是员工最大的福利!2022新员工入职安全培训全员篇
- Face to face experience --- test engineer web side automation --- interview questions for large factories
- Hack the box:routerspace
- 7-1 懂的都懂
- 剑指offer II 091.粉刷房子
- Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
猜你喜欢

linux下修改mysql端口号

异或的应用。(提取出数字中最右侧的1,面试中经常用的到)

Redis one master multi slave cluster setup

Modifying MySQL port number under Linux

HTTP Caching Protocol practice

Devtools implementation principle and performance analysis practice

Design and implementation of spark offline development framework

SQL statement optimization steps (1)

A gadget can write crawlers faster

ACM笔记
随机推荐
同花顺网上开户安全吗
Detailed explanation of collection class methods____ (4) Judgment and assignment, etc
Evaluation of inverse Polish expression < difficulty coefficient >
Mysql8.0 and mysql5.0 accessing JDBC connections
mysql57 zip文件安装
7-2 芬兰木棋 结构体排序
kubernetes删除pod的流程的源码简析
腾讯下半年继续裁员,所有事业群至少缩减 10%,对此你怎么看?关注者
Principle and practice of bytecode reference detection
QT -- 通讯协议
Solving the longest palindrome substring by dynamic programming
Introduction and several months' experience of extending the solution thanos of Prometheus
Encyclopedia of scala operators
[ thanos源码分析系列 ]thanos query组件源码简析
R语言绘制 ggplot2 季节性图
看似简单的光耦电路,实际使用中应该注意些什么?
ice - 资源
Investment transaction and settlement of the fund
Optimization steps of SQL statements (II) -- MySQL statement optimization
ABAP skill tree