Problem:


Score : 200 points

Problem Statement

Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.

She will concatenate all of the strings in some order, to produce a long string.

Among all strings that she can produce in this way, find the lexicographically smallest one.

Here, a string s=s_1s_2s_3...s_n is lexicographically smaller than another string t=t_1t_2t_3...t_m if and only if one of the following holds:

There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i.

s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.

Constraints

1 ≦ N, L ≦ 100

For each i, the length of S_i equals L.

For each i, S_i consists of lowercase letters.

Input

The input is given from Standard Input in the following format:

N L
S_1
S_2
:
S_N

Output

Print the lexicographically smallest string that Iroha can produce.

Sample Input 1

3 3
dxx
axx
cxx

Sample Output 1

axxcxxdxx

The following order should be used: axx, cxx, dxx.



Sample input:
3 3
dxx
axx
cxx


Sample output:
axxcxxdxx

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Y(): print("Yes"); return
def N(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,L = IL()
S = SLs(N)

S.sort()

print(*S,sep="")

Submission status: Accepted

Solution code:
n, l = list(map(int, input().split()))

list_of_words = []

for _ in range(n):
    s = input()
    list_of_words.append(s)

list_of_words.sort()

answer = ""
for word in list_of_words:
    answer += word

print(answer)

Submission status: Accepted

Solution code:
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    num, length = map(int, input().split())
    s = []
    for i in range(int(num)):
        s.append(input())
    s.sort()
    print(''.join(s))
    
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
S = [input() for i in range(N)]

S.sort()
ans = []
for i in range(N):
    ans += S[i]
print(''.join(ans))

Submission status: Accepted

Solution code:
N,L = [int(_) for _ in input().split()]
S = [input().split()[0] for _ in range(N)]

print("".join(sorted(S)))

Submission status: Accepted

Solution code:
N,L = map(int, input().split())
S = []
for i in range(N):
    s = input()
    S.append(s)
S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
n,l = map(int, input().split())
s = sorted([input() for i in range(n)])
print(''.join(s))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,L=map(int,input().split())
    S=[input() for i in range(N)]
    S.sort()
    for s in S:
        print(s,end='')
    print('')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,l = map(int,(input().split()))
a =[input() for i in range(n)]
a.sort()
print(''.join(a))

Submission status: Accepted

Solution code:
N, L = map(int,input().split())
S = [input() for _ in range(N)]
S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
x =  list(input() for i in range(N))
s = "".join(sorted(x))
print(s)

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
dic = []
for i in range(n):
    dic.append(input())

dic.sort()
print(''.join(dic))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = ''.join(sorted((input() for _ in range(N))))
print(S)

Submission status: Accepted

Solution code:
import numpy as np

  
def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

N,L=map(int,input().split())
S=[]
l=[]
for i in range(N):
  S.append(input())
  l.append(alpha2num(S[i]))
l=np.array(l)
l=l.argsort()
s=""
for j in range(N):
  s+=S[l[j]]
print(s)

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
S = [input() for _ in range(N)]

s = sorted(S)
ans = "".join(s)
print(ans)

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = []
for _ in range(n):
  s.append(input())
s.sort()
ans = ''
for word in s:
  ans += word
print(ans)

Submission status: Accepted

Solution code:
N,L = map(int, input().split())

S=[]

for i in range(N):
    S.append(input())

print("".join(sorted(S)))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
words = [input() for _ in range(n)]
words.sort()
print("".join(words))

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
list=[]
for _ in  range(n):
  list.append(str(input()))
str=""
for i in range(n):
  str+=sorted(list)[i]
print(str)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
S = ''.join(S)
print(S)

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = []
for _ in range(n):
	s.append(input())
s.sort()
a = ''
for i in s:
    a = a+i
print(a)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

N,L = map(int,input().split())

S = [str(input()) for _ in range(N)]
S.sort()
print(*S,sep="")

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
str=[]
for i in range(n):
    str.append(input())
str.sort()
strn=''.join(str)
print(strn)

Submission status: Accepted

Solution code:
n, l = list(map(int, input().split()))

s = []
for _ in range(n):
    s.append(input())
s.sort()
print("".join(s))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
lists = []
for i in range(N):
    lists.append(input())

lists.sort()
print(''.join(lists))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
list = [input() for _ in range(n)]
sorted_list = sorted(list)
print(''.join(sorted_list))

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
s = []
for _ in range(n):
    s.append(input())
s = sorted(s)
print(''.join(map(str, s)))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
for x in s:
  print(x, end="")
print()

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
S=[input()for _ in range(N)]

S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = sorted(input() for i in range(n))
print(*s, sep='')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, l = mi()
    strings = [input() for _ in range(n)]
    strings.sort()
    print(''.join(strings))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,l = map(int, input().split())
a = []
for i in range(n):
  a.append(input())
a.sort()
print(*a, sep= '')

Submission status: Accepted

Solution code:
#input
s=[]
n,b=map(int,input().split())

for i in range(n):s.append(input())

print(''.join(sorted(s)))

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
ans=[]
for i in range(n):
    ans.append(input())
print("".join(sorted(ans)))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = []
for i in range(N):
    S.append(input())

S_sort = sorted(S)
str = ''
for i in range(N):
    str += S_sort[i]
print(str)

Submission status: Accepted

Solution code:
N,L = list(map(int,input().split()))
S = sorted([input() for _ in range(N)])
print(''.join(S))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = [input() for i in range(N)]
print("".join(sorted(S)))

Submission status: Accepted

Solution code:
n , l = map(int , input().split())
s = [input() for i in range(n)]
s.sort()
print(''.join(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N, L = map(int, input().split())
S = []
for n in range(N):
    S.append(input())
S.sort()
print("".join(S))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())

S = []

for i in range(N):
    S.append(input())

S.sort()

print("".join(S))

Submission status: Accepted

Solution code:
n, l = map(int,input().split())
a = [input() for i in range(n)]
a.sort()
print("".join(a))

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
word = []
for x in range(N):
    wd = input()
    word.append(wd)

word_sort = sorted(word)

print("".join(word_sort))

Submission status: Accepted

Solution code:
def main():
 num = list(map(int,input().split()))
 value =  [input() for i in range(num[0])]
 value_sorted=sorted(value)
 print(''.join(value_sorted))

main()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=[input() for i in range(n)]
l.sort()
ans=''.join(l)
print(ans)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
s = [input() for i in range(N)]
s2 = sorted(s)
print("".join(s2))

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
S_hai = []
ans = ""

for _ in range(N):
    S_hai.append(input())
    
sort_S = sorted(S_hai)

for i in sort_S:
    ans += i
    
print(ans)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
s = [input() for i in range(N)]
s2 = sorted(s)
ans = ""
for i in range(N):
    ans += s2[i]
print(ans)

Submission status: Accepted

Solution code:
def main():
    n, l = map(int, input().split())
    S = list(input() for _ in range(n))

    print(''.join(sorted(S)))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
str_list=sorted([input() for i in range(N) ])
s=''
for i in range(N):
    s+=str_list[i]
print(s)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = []
for i in range(N):
    S.append(input())
S.sort()
A = ''
for i in range(N):
    A += S[i]
print(A)

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
wordlist = []
for i in range(N):
    x = input()
    wordlist.append(x)

answer = "".join(sorted(wordlist))
print(answer)

Submission status: Accepted

Solution code:
N,L=map(int, input().split())
S=['']*N
for i in range(N):
    S[i]=str(input())
S.sort()
t=''
for i in range(N):
    t+=S[i]
print(t)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))

Submission status: Accepted

Solution code:
tmp = list(map(int, input().split()))
N = tmp.pop(0)
L = tmp.pop(0)
S = []

for i in range(N):
    S.append(str(input()))

S.sort()
s = ''
for i in range(N):
    s += S[i]

print(s)

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
s = sorted(s)
for i in range(n):
    print(s[i],end='')

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = sorted(input() for _ in range(N))
print(''.join(S))

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
MAX = 10**18
MIN = -10**18

n,l = map(int,input().split())
S = [input() for i in range(n)]
S.sort()
ans = ""
for i in S:
    ans += i
print(ans)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
lists = []
for n in range(N):
    lists.append(input())
print(''.join(sorted(lists)))

Submission status: Accepted

Solution code:
from sys import exit

n,l = map(int, input().split())
s = [input() for i in range(n)]

ss = sorted(s)
ans=""
for i in range(n):
    ans +=ss[i]
print(ans)

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
L = [input() for _ in range(n)]
L.sort()
print("".join(L))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = list()
for a in range(0, n):
    s.append(input())

s = list(sorted(s))

print(''.join(s))

Submission status: Accepted

Solution code:
n, l = [int(i) for i in input().split()]
ss = [input() for _ in range(n)]
ss.sort()
for s in ss:
    print(s, end="")
print("")

Submission status: Accepted

Solution code:
from functools import reduce
n, l = (int(x) for x in input().split())
ss = [input() for i in range(n)]
ss.sort()
print(reduce(lambda x, y: x+y, ss))

Submission status: Accepted

Solution code:
N = input().split(" ")
a = int(N[0])
b = int(N[1])

l = []
for i in range(a):
    l.append(input())
 
l.sort()    
print("".join(l))

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
l=[]
for i in range(N):
    S=input()
    l.append(S)
#print(l)
l2=sorted(l)
#print(l2)
ans="".join(l2)
print(ans)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
string = ''
str_list = [input() for _ in range(N)]
str_list.sort()
for s in str_list:
    string += s
print(string)

Submission status: Accepted

Solution code:
N, L = map(int,input().split())
S = []
for _ in range(N):
	S.append(input())

sorted_S = sorted(S)

string = ""
for str in sorted_S:
  string += str

print(string)

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(''.join(s))

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    N,L=pin()
    SS=[input() for i in range(N)]
    SS.sort()
    #print(SS)
    print(*SS,sep="",end='\n')
#%%submit!
resolve()

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
word_list = [input() for nesya in range(n)]
s = sorted(word_list)
ans = ''
for hoge in s:
  ans += hoge
print(ans)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
word = [input() for i in range(N)]
Word = sorted(word)

for i in Word:
    print(i, end='')

Submission status: Accepted

Solution code:
N , L = map(int,input().split())
lis = list()
for i in range(N):
    lis.append(str(input()))

lis.sort()
print("".join(lis))

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = []
for _ in range(N):
    S.append(input())

S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
N,L = map(int, input().split())
scripts =[]
for i in range(N):
  temp = input()
  scripts.append(temp)

scripts.sort()
ans = ''.join(scripts)
print(ans)

Submission status: Accepted

Solution code:
x = list(map(int,input().split()))

N = x[0]
L = x[1]

ls_N = []

for i in range(N):
    n = input()
    ls_N.append(n)

ls_N = sorted(ls_N)

# "".join(配列)で，””の中のものが入る．ただ続けたい場合は””の中に何も入れない

# sortedした文字列は自動で辞書順
s = "".join(ls_N)
print(s)

Submission status: Accepted

Solution code:
n , l = map(int,input().split())
s = [input() for i in range(n)]
s.sort()
for i in s:
    print(i,end="")
print()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, l = map(int, input().split())
words = []

for i in range(n):
    words.append(input())

words.sort()

print(''.join(words))

Submission status: Accepted

Solution code:
N,L = map(int,input().split())

strs = []
for i in range(N):
    n = input()
    strs.append(n)

strs.sort()
print("".join(strs))

Submission status: Accepted

Solution code:
inputNL = input().split(" ")
N = int(inputNL[0])
L = int(inputNL[1])
 
inputs = []
for n in range(N):
  inputs.append(input())
 
inputs.sort()
answer = "".join(inputs)
print(answer)

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
s = [""]*n
for i in range(n):
  s[i] = input()
s.sort()
ans = ""
for x in s:
  ans += x
print(ans)

Submission status: Accepted

Solution code:
def main():
    N, L = map(int, input().split())
    S = [input() for _ in range(N)]
    S.sort()
    print(''.join(S))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
ans = ""

for each in s:
  ans += each
  
print(ans)

Submission status: Accepted

Solution code:
NL = input().split()
N = int(NL[0])
L = int(NL[1])

st = []
for i in range(N):
    a = input()
    st.append(a)
s_st = sorted(st)
dic = ""
for j in range(len(s_st)):
    dic += s_st[j]
print(dic)

Submission status: Accepted

Solution code:
N ,L =map(int,input().split())
S = [input() for i in range(N)]
S.sort()
print("".join(S))

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
s=[0]*n
for i in range(0,n):
  s[i]=str(input())
s.sort()
result="A"
for i in range(0,n):
  result=result+str(s[i])
result=result.lstrip("A")
print(result)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = [input() for i in range(N)]
S.sort()

print("".join(S))

Submission status: Accepted

Solution code:
n,l = map(int, input().split())
arr = []
for _ in range(n):
  arr.append(input())
arr.sort()
ans = ""
for s in arr:
  ans += s
print(ans)

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
list=[]
for i in range(n):
  s=input()
  list.append(s)
list.sort()
ans=list[0]
for i in range(n-1):
  ans=ans+list[i+1]
print(ans)

Submission status: Accepted

Solution code:

N, L = map(int, input().split())
S = [input() for i in range(1,N+1)]

print(''.join(sorted(S)))

Submission status: Accepted

Solution code:
n, l = list(map(int, input().split()))
s = []
for i in range(n):
    s.append(str(input()))

s = sorted(s)

ans = ""

for i in range(n):
    ans += s[i]
print(ans)

Submission status: Accepted

Solution code:
n, l = map(int, input().split())

S = sorted(input() for _ in range(n))

print("".join(S))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,l=map(int, input().split())
    l=[input() for i in range(n)]
    l.sort()
    print(''.join(l))
resolve()

Submission status: Accepted

Solution code:
n, l = (int(x) for x in input().split())
apple = []
for _ in range(n):
    s = str(input())
    apple.append(s)

orange = sorted(apple)
print("".join(orange))

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
s = []
for i in range(n):
  ss = input()
  s.append(ss)

s.sort()
ans = ''
for i, ss in enumerate(s):
  ans += ss
print(ans)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
l = []
for _ in range(n):
  l.append(input())
l.sort()
s = ""
for i in l:
  s += i
print(s)

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
S=[]
for _ in range(N):
    S.append(input())
S.sort()
for i in range(N):
    print(S[i],end="")

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
s = []
for i in range(N):
    s.append(input())
s.sort()
print(*s,sep= "")

Submission status: Accepted

Solution code:
N, L = map(int, input().split())

S = [None] * N
for i in range(N):
    S[i] = input()

S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 1行目
N,L = map(int,input().split())
mylist = []
for i in range(N):
  val = input()
  if val:
    mylist.append(val)
  else:
    break
    
s = ""  
mylist.sort()
for a in mylist:
  s += a
print(s)

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
s=[input() for _ in range(n)]
print("".join(sorted(s)))

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
S=[]
for i in range(N):
  S.append(input())
 
S.sort()
str=''
for i in range(N):
  str=str+S[i]

print(str)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
Mylist = []
for i in range(N):
  S = input()
  Mylist.append(S)
 
ANSlist = sorted(Mylist)
ANS = ''.join(ANSlist)
print(ANS)

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
S = [str(input()) for _ in range(N)]

print(''.join(sorted(S)))

Submission status: Accepted

Solution code:
N,L=map(int, input().split())
S=[input() for i in range(N)]

S=sorted(S)
c=''
for i in range(N):
  c+=S[i]
print(c)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s=sorted([input() for i in range(a)])
print(*s,sep="")

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)
###################################################

def main():
    n,l=map(int,input().split())
    S=[]
    for a in range(n):
        S.append(input())
    S.sort()
    print("".join(S))
main()

Submission status: Accepted

Solution code:
n,l=list(map(int,input().split()))
S=[input() for i in range(n)]
S.sort()
ans=''.join(S)
print(ans)

Submission status: Accepted

Solution code:
N, L = list(map(int, input().split()))
S = []
for i in range(N):
    S.append(input())
S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:
n,l = map(int, input().split())
s = sorted([input() for i in range(n)])
print(*s,sep="")

Submission status: Accepted

Solution code:
n, l = map(int, input().split())

s = sorted([input() for _ in range(n)])

print("".join(s))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = [input() for i in range(n)]
print(*sorted(s), sep="")

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
li = []
for _ in range(n):
    li.append(input())
li.sort()
print(''.join(li))

Submission status: Accepted

Solution code:
def constructString(strs):
  return "".join(sorted(strs))

strs = []
n, l = map(int, input().split())
for _ in range(n):
  strs.append(input())
print(constructString(strs))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
i = 0
s = list()
while i<n:
    s.append(str(input()))
    i+=1

i=0
while i<n:
    w = "z"*l
    j = 0
    while j < n:
        if s[j] <w:
            x = j
            w = s[j]
        j+=1
    if i == 0:
        ans = w
    else:
        ans += w
    s[x] = "z"*l
    i += 1
print(ans)

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
lists = sorted([input() for _ in range(n)])
word = ""
for i in lists:
  word += i
print(word)