当前位置:网站首页>字符串排序
字符串排序
2022-04-23 15:34: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
n = int(input())
list = []
if 1 <= n <= 1000 :
for i in range(n):
b = input()
if 1 <= len(b) <= 100:
list.append(b)
list.sort()
# for j in list:
# print(j)
print('\n'.join(list))
版权声明
本文为[叶宁夏昕]所创,转载请带上原文链接,感谢
https://blog.csdn.net/come_bn/article/details/124309602
边栏推荐
- The El tree implementation only displays a certain level of check boxes and selects radio
- 深度学习——超参数设置
- php类与对象
- 木木一路走好呀
- MySQL InnoDB transaction
- What role does the software performance test report play? How much is the third-party test report charged?
- Common interview questions of operating system:
- Educational codeforces round 127 A-E problem solution
- el-tree实现只显示某一级复选框且单选
- Redis cluster principle
猜你喜欢
山寨版归并【上】
[leetcode daily question] install fence
Explanation 2 of redis database (redis high availability, persistence and performance management)
Sword finger offer (2) -- for Huawei
自主作业智慧农场创新论坛
Knn,Kmeans和GMM
Detailed explanation of MySQL connection query
【AI周报】英伟达用AI设计芯片;不完美的Transformer要克服自注意力的理论缺陷
Analysis of common storage types and FTP active and passive modes
网站建设与管理的基本概念
随机推荐
c语言---指针进阶
自主作业智慧农场创新论坛
Advantages, disadvantages and selection of activation function
控制结构(一)
Byte interview programming question: the minimum number of K
el-tree实现只显示某一级复选框且单选
使用 Bitnami PostgreSQL Docker 镜像快速设置流复制集群
API gateway / API gateway (II) - use of Kong - load balancing
How did the computer reinstall the system? The display has no signal
Demonstration meeting on startup and implementation scheme of swarm intelligence autonomous operation smart farm project
KNN, kmeans and GMM
通过 PDO ODBC 将 PHP 连接到 MSSQL
Modify the default listening IP of firebase emulators
MultiTimer v2 重构版本 | 一款可无限扩展的软件定时器
HJ31 单词倒排
Code live collection ▏ software test report template Fan Wen is here
移动app测试如何进行?
Cookie&Session
Openstack command operation
Example of time complexity calculation