当前位置:网站首页>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)
边栏推荐
- Unity-UI-shadow组件
- XML serialization backward compatible
- 2021 programming language ranking summary
- 大型项目中的Commit Message规范化控制实现
- Kubelet garbage collection (exiting containers and unused images) source code analysis
- 看似简单的光耦电路,实际使用中应该注意些什么?
- R 语言 Hitters 数据分析
- Spark 离线开发框架设计与实现
- Is it reliable to register and open an account for stock speculation? Is it safe?
- Evolution of vivo push platform architecture
猜你喜欢
hack the box:RouterSpace题解
安全培训是员工最大的福利!2022新员工入职安全培训全员篇
Leetcode learning records
Devtools implementation principle and performance analysis practice
Redis one master multi slave cluster setup
Modifying MySQL user name root under Linux
The practice of traffic and data isolation in vivo Reviews
PLC -- Notes
Hash slot of rediscluster cluster cluster implementation principle
8 张图 | 剖析 Eureka 的首次同步注册表
随机推荐
Jetpack - defects of livedata component and Countermeasures
Llvm and clang
flutter 实现摇一摇功能
Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough
Is it safe to open an account on Dongfang fortune
异或的应用。(提取出数字中最右侧的1,面试中经常用的到)
Modifying MySQL port number under Linux
扩展Prometheus的解决方案thanos的简介和几个月使用心得
剑指offer II 091.粉刷房子
LLVM 与 Clang
Design and implementation of spark offline development framework
Sword finger offer|: linked list (simple)
Code submission specification
linux下修改mysql用户名root
In idea, the get and set methods may be popular because the Lombok plug-in is not installed
网传互联网公司加班表,排名第一的没悬念
Using interceptor and cache to complete interface anti brushing operation
SQL statement optimization steps (1)
打新债注册开户靠谱吗?安全吗?
Leetcode+ 51 - 55 retrospective and dynamic planning topics