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:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n,l=MI()
lis=[input().rstrip() for i in range(n)]
u=sorted(lis)
#print(u)
print("".join(u))

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=[input()for i in range(N)]
print(''.join(sorted(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:
def nyu():
    H,W = map(int,input().split())
    S = [input() for _ in range(H)]
    S.sort()
    return S

S = nyu()
ans =""

for s in range(len(S)):
    ans += S[s]



print(ans)

Submission status: Accepted

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

s.sort()
s = ''.join(s)

print(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()) #a1 a2 a3

s = [input() for i in range(n)] 

s.sort()


print(''.join(s))

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, l = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    S = [input() for i in range(n)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    #S = [list(map(str, input().split())) for i in range(n)]

    Ssort = sorted(S)
    print("".join(Ssort))
resolve()

Submission status: Accepted

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

s = [input() for _ in range(n)]
i = sorted(s)
print(''.join(i))

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, L = list(map(int,_in[0].split(' ')))
    S_arr = []
    for i in range(N):
        _ =     _in[i+1]   # type:str
        S_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    S_arr.sort()
    s = ''.join(S_arr)
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    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 s:
    print(i, end='')
print()

Submission status: Accepted

Solution code:
print(*sorted(open(0).read().split()[2:]),sep="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(N):
  words.append(input())
for i in sorted(words):
    t += i

print(t)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
MOD = 1000000007

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

S = []
for _ in range(N):
    S.append(input()[:-1])

S.sort()

for i in range(N):
    print(S[i],end="")

print("")

Submission status: Accepted

Solution code:
n , m = map(int,input().split())
mojiretsu =''
str_list = [input() for _ in range(n)]
str_listss = sorted(str_list) 
for i in str_listss:
  mojiretsu += i
print(mojiretsu)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b
# Python 3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(allNumber, eachStrings):
    result = ''
    # algorithm
    eachStrings.sort()
    result = "".join(eachStrings)
    return result


if __name__ == "__main__":
    N, L = MI()
    SI = []
    for j in range(0, N):
        tmpStrList = list(map(str, sys.stdin.readline().split()))
        SI.append(tmpStrList[0])
    print("{}".format(solver(N, SI)))

Submission status: Accepted

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



if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

sorted_list_S = sorted(list_S)
ans = ''.join(sorted_list_S)

print(ans)

Submission status: Accepted

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

lStr = [input() for i in range(lNL[0])]

lStr.sort()

ans = ''.join(lStr)
print(ans)

Submission status: Accepted

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

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 = [input() for _ in range(n)]
s_sorted = sorted(s)
ans = "".join(s_sorted)
print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, l = na()
s = nsn(n)
s.sort()

print(*s, sep="")

Submission status: Accepted

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

def main():
    *N, = map(str, open(0).read().split())
    S = N[2:]
    L = int(N[1])
    N = int(N[0])

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


main()

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    n, l = MII()
    ss = [IS() for _ in range(n)]
    ss.sort()
    print(''.join(ss))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

s=[]
for i in range(n):
  
  s_tmp=input()
  s.append(s_tmp)
  
s.sort()
res=''.join(s)

print(res)

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())
sn = [input() for _ in range(N)]
sn.sort()
ans = ''
for s in sn:
    ans += s
print(ans)

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 = [input() for i in range(N)]
ans = ""
for i in range(N):
    tmp = min(S)
    S.remove(tmp)
    ans += tmp

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, L = map(int, input().split())
# 文字列の入力
#s = input()
#print(s[0:K-1]+s[K-1].lower()+s[K:N])
list = []

for i in range(N):
    s = input()
    list.append(s)

list = sorted(list)

ans = "".join(list)


print(ans)

Submission status: Accepted

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

strlist.sort()
ans = ''
for i in range(len(strlist)):
  ans = ans + strlist[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,L = map(int, input().split())
s = [input() for i in range(N)]
s.sort()
S = ""
for i in range(N):
    S = S + s[i]
    
print(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:
if __name__ == '__main__':
    n, l = map(int, input().split())

    lst = []
    for i in range(n):
        lst.append(input())
    lst.sort()

    for s in lst:
        print(s,end="")

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())

words = []

for _ in range(N):
    words.append(input())

sor_words =sorted(words)

for i in range(N):
    print(sor_words[i],end="")

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline

def main():
    N, L = map(int, readline().rstrip().split())
    S = [readline().rstrip() for _ in range(N)]
    S.sort()
    print(*S, sep='')

if __name__ == '__main__':
    main()

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:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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())

input_list=[]

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

input_list.sort()

out =''

for i in range(n):
    out += input_list[i]

print(out)

Submission status: Accepted

Solution code:
#! python3
def main():
    n, l = map(int, input().split())
    slist = []
    for i in range(n):
        s = input()
        slist.append(s)

    slist.sort()
    print("".join(slist))

main()

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:
# Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(str, sys.stdin.readline().split()))


def LS(): return list(map(str, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(allNumber, eachStringList):
    result = ""
    # algorithm
    eachStringList.sort(reverse=False)
    #    print("{}".format(eachStringList))
    result = result.join(eachStringList)
    return result


if __name__ == "__main__":
    N, _ = MI()
    SI = []
    for j in range(N):
        tmpList = LS()
        SI.append(tmpList[0])
    print("{}".format(solver(N, SI)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
# Problem: https://atcoder.jp/contests/abc042/tasks/abc042_b
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(allNum, longLeng, eachString):
    result = ''
    eachString.sort()
    result = "".join(eachString)
    return result


if __name__ == "__main__":
    N, L = MI()
    SI = []
    for _ in range(0, N, +1):
        getStrList = sys.stdin.readline().split()
        SI.append(getStrList[0])
    print("{}".format(solver(N, L, SI)))

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, _ = map(int, input().split())

print(*sorted([input() for _ in range(n)]), sep="")

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 =  list(map(int,input().split()))
listA = []
for i in range(N):listA.append(input())
listA.sort()
print("".join(listA))

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
b=[]
for i in range(a[0]):
  b.append(input())
b.sort()
print("".join(b))

Submission status: Accepted

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

Submission status: Accepted

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

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

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 = [""] * n
ans = ""
for i in range(n):
    s[i] = input()
s = sorted(s)
for i in range(n):
    ans += s[i]
print(ans)

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:
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, L = read_ints()
    S = []
    for _ in range(N):
        S.append(input().strip())
    S.sort()
    return ''.join(S)


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
number, length = map(int, input().split())

dict_list = []

for i in range(number):
 dict_list.append(input())

new_dict_list = sorted(dict_list)

answer = ''.join(new_dict_list)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, L = map(int, readline().split())
    S = []
    for _ in range(N):
        S.append(input())
    S.sort()
    ans = ''
    for i in range(N):
        ans += S[i]
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(''.join(sorted(f)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
input_line = input().split()
vertical = int(input_line[0])
row = int(input_line[1])
line = list()
for i in range(vertical):
    line.append(input())
    
line.sort()
for i in line:
    print(i ,end = "")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

out = ''
for i in range(len(S)):
  out += S[i]
print(out)

Submission status: Accepted

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

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

Submission status: Accepted

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

lis = []

for n in range(N):
  lis.append(input())
  j = n
  if not n == 0:
    while lis[j-1]>lis[j] and j>0:
      lis[j-1:j+1] = [lis[j], lis[j-1]]
      j -= 1

ans = ''
      
for e in lis:
  ans += e
  
print(ans)

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
d=[list(str(input())) for i in range(N)]
d.sort()
d_list=d[0]
for i in range(1,len(d)):
    d_list+=d[i]
print("".join(d_list))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, l = map(int, input().split())
    S = sorted(list(input() for _ in range(n)))
    print("".join(S))


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n = [int(tmp) for tmp in input().split()]
a = []
for i in range(n[0]) :
	s = input()
	a.append(s)
a.sort()
print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
line  =input().split(' ')
ln = []
for i in range(int(line[0])):
    ln.append(input())
outline= ''
for i in sorted(ln):
    outline += i
print (outline)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N, L = map(int, input().split())
    S = [None] * N
    for i in range(N):
        S[i] = input().rstrip()

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
s_list = "abcdefghijklmnopqrstuvwxyz"
N,L=map(int, input().split())
S=[]
Ls=[]
for i in range(N):
  s = str(input())
  S.append(s)
  ls=0
  for k in range(L):
    ls = ls + s_list.index(s[L-k-1])*(100**k)
  Ls.append(ls)
  
Ls = np.array(Ls)

ind = Ls.argsort()
ans = ""
for i in range(N):
  ans = ans + S[ind[i]]
print(ans)

Submission status: Accepted

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

S.sort()
str1=''
for i in range (H):
    str1=str1+S[i] 
print(str1)

Submission status: Accepted

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

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())
table = [input() for _ in range(N)]
table.sort()

print("".join(table))

Submission status: Accepted

Solution code:
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:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,l=mii()
arr=[]
for i in range(n):
    arr.append(ss())

arr.sort()
print("".join(arr))

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 = sorted([input() for i in range(N)])
print("".join(S))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2020/04/24
# AtCoder Beginner Contest 042 - B

# Input
n, l = map(int,input().split())
s = list()

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

s.sort()

# Output
print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

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:
def main(input: list):
    print("".join(sorted(input)))


[N, L] = list(map(int, input().split()))
input = [input() for _ in range(N)]
main(input)

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(ans)

Submission status: Accepted

Solution code:
N, Z = map(int, input().split())
list1 = [input() for _ in range(N)]
list2 = sorted(list1)
print(''.join(list2))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = [0] * n
for i in range(n):
    s[i] = input()
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)
print(*S, sep = "")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=input().split();print("".join(sorted([input() for i in range(int(n))])))

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:
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())

list = [str(input()) for i in range(n)]
List = sorted(list)
a = str()
for i in range(len(List)):
    a += str(List[i])
    
print(a)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(*a,sep="")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,l = map(int, input().split())
    s = [input().rstrip() for _ in range(n)]
    s.sort()
    print(''.join(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
import math

[N, L] = list(map(int, stdin.readline().rstrip().split()))
S = [input() for i in range(N)]

S_sorted = sorted(S)

print(''.join(S_sorted))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=['']*a
ans=''
for i in range(a):
    s[i]=input()
s.sort()
for i in range(a):
    ans=ans+s[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(N):
    ans += min(S)
    del S[S.index(min(S))]

print(ans)

Submission status: Accepted

Solution code:
N,L = (int(x) for x in input().split())
alist = [input() for i in range(N)]
newlist = sorted(alist)

res = ""
for i in newlist:
    res = res + newlist[0]
    newlist = newlist[1:]
print(res)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
L=[]
for i in range(a):
    L.append(input())
    
    K=sorted(L)
print(''.join(K))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = []

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

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,L = map(int,input().split())
Slist = [input() for _ in range(N)]

Slist.sort()

print(*Slist,sep="")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
num, len = map(int, input().split())

strings = []
for n in range(num):
    strings.append(input())

strings.sort()

print(''.join(strings))

Submission status: Accepted

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

result = ""
for i in sorted_S:
    result += i

print(result)

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:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, l = list(map(int, readline().split()))

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

    s.sort()

    print(*s,sep="")


if __name__ == '__main__':
    main()