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:
n, m = [int(i) for i in input().split()]
print (str().join(sorted([input() for i in range(n)])))

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
l = int(arr_data[0][1])

arr=[]

for i in range(1,1+n):
    
    arr.append(arr_data[i][0])
    
arr.sort()


print("".join(arr))

Submission status: Accepted

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    n, length = list(map(int, input().split()))
    s = sorted([input() for _ in range(n)])

    print(''.join(s))

Submission status: Accepted

Solution code:
inpt = map(int, raw_input().split())
lst = []

for i in range(0, inpt[0]):
	lst.append(raw_input())

lst.sort()

s = ''
for i in range(0, inpt[0]):
	s = s + lst[i]

print s

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input().split()[0])

S_list = []

for row in range(N):
    S_list.append(input())
    
S_list = sorted(S_list)
print("".join(S_list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
str_list = [input() for i in range(n)]

str_list.sort()

print("".join(str_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    nl = input.readline().split()
    n = int(nl[0])
    _ = int(nl[1])
    s = []
    for _ in range(0, n):
        s.append(input.readline().strip())
    s.sort()
    output.write("".join(s) + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)

Submission status: Accepted

Solution code:
n,l = input().split()
n = int(n)
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 = list(input().strip() for _ in range(n))
s_sorted = sorted(s)
print(''.join(s_sorted))

Submission status: Accepted

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

sn.sort()
print(''.join(sn))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S.sort()
result = ""
for i in range(N):
    result += S[i]
print(result)

Submission status: Accepted

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

s.sort()
a = ''
for i in range(n):
    a+=s[i]

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,L=map(str,input().split())
line = []
for i in range(int(N)):
  tmp = input().rstrip()
  line.append(tmp)
line.sort()
result = ''.join(line)
print(result)

Submission status: Accepted

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

S = sorted(S)

print(''.join(S))

Submission status: Accepted

Solution code:
import sys

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    inf = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return inf.readline()
else:
    inf = sys.stdin

# ==============================================================

def main():
    n, l = [int(x) for x in input().split()]
    s = []
    for _ in range(n):
        s.append(input())

    s.sort()
    print("".join(s))


main()

# ==============================================================

if debug_mode:
    inf.close()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, l = [int(i) for i in 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())
s=[input() for i in range(n)]
s=sorted(s)
a=""
for i in range(n):
    a+=s[i]
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    ans = ""
    for s in sorted(S):
        ans += s
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

T=[]
for i in range(N):
    s=min(S)
    T.append(s)
    S.pop(S.index(s))

Ts=""
for i in range(len(T)):
    Ts+=T[i]

print(Ts)

Submission status: Accepted

Solution code:
import sys

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

S.sort()
for j in range(N):
	sys.stdout.write(S[j])

print("")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc042/tasks/abc042_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(data):
    data.sort()
    return data


def main(args):
    N, L = map(int, input().split())
    data = [input().strip() for _ in range(N)]
    ans = solve(data)
    print(*ans, sep='')


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print ''.join(sorted([raw_input() for _ in xrange(int(raw_input().split()[0]))]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(str(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 = []
for i in range(n):
   s.append(input())

s.sort()

print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

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

array = []
for i in range(n):
    array.append(input())
sort_array = sorted(array)
print("".join(sort_array))

Submission status: Accepted

Solution code:
N,L = map(int,input().split())
s = []
for n in range(N):
    s.append(input())
s = sorted(s)
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()
moji=""
for i in s:
    moji+=i
print(moji)

Submission status: Accepted

Solution code:
n=int(input().split()[0])
print("".join(sorted([input() for _ in [0]*n])))

Submission status: Accepted

Solution code:
# main関数
if __name__ == '__main__':

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

    a.sort()

    for i in range(n) :
        print(a[i], end="")

    print()

Submission status: Accepted

Solution code:
import sys
n, l = map(int, sys.stdin.readline().split())
words = []
for i in range(n):
    s = input()
    words.append(s)

words.sort()
print(''.join(words))

Submission status: Accepted

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

lis = []



for i in range(N):
	a = input()
	lis.append(a)

lis.sort()
print(''.join(lis))

Submission status: Accepted

Solution code:
ri=(raw_input()).split(" ")
n=int(ri[0])
l=int(ri[1])
s=[""]*n
for i in range(n):
    s[i]=raw_input()

s=sorted(s)

r=""
for i in range(n):
    r+=s[i]

print(r)

Submission status: Accepted

Solution code:
def solve():
    N, L = list(map(int, input().split()))
    S_list = []
    ans = ""
    for i in range(N):
        S_list.append(input())
    S_list = sorted(S_list)
    for str in S_list:
        ans += str
    print(ans)

solve()

Submission status: Accepted

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

print("".join(sorted(li)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, L = [int(n) for n in 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 = [input() for i in range(n)]

s.sort()
print(''.join(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""042-b"""


from queue import PriorityQueue
import sys


def main():
    """Main function."""
    pq = PriorityQueue()
    N, L = map(int, sys.stdin.readline().split(' '))

    for l in range(N):
        pq.put(sys.stdin.readline()[:-1])

    while True:
        sys.stdout.write(pq.get())
        if pq.empty():
            break
    sys.stdout.write('\n')


if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    N, L = map(int, input().split())
    SS = [input() 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 _ in range(N):
    S.append(input())
print(''.join(sorted(S)))

Submission status: Accepted

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

arr = [input() for i in range(n)]
arr.sort()
print("".join(arr))

Submission status: Accepted

Solution code:
nyuuryoku_num , _ = [int(i) for i in input().split()]

test_lists = [input() for i in range(nyuuryoku_num)]
print("".join(sorted(test_lists)))

Submission status: Accepted

Solution code:
a,b=(int(i) for i in input().split()) 
c=[]
for i in range(a):
  c.append(input())
c.sort()
d=""
for i in range(a):
  d=d+c[i][0:b]


print(d)

Submission status: Accepted

Solution code:
n=int(input().split()[0]);print(''.join(sorted([input()for _ in[0]*n])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, L = list(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()))
memo = []
for i in range(N):
    memo.append(input())
memo.sort()
for j in range(N):
    print(memo[j],end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, l = map(int, raw_input().strip().split())
a = []
for x in xrange(n):
	a.append(raw_input().strip())
a.sort()
ans = ''
for x in a:
	ans += x
print(ans)

Submission status: Accepted

Solution code:
a=input().split()
N=int(a[0])
L=int(a[1])
S=[input() for i in range(N)]
S.sort()
ans=''.join(S)
print(ans)

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 i in range(N)]
print(''.join(sorted(S)))

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N, L = map(int, input().split())
    S_list = [input() for _ in range(N)]
    print("".join(sorted(S_list)))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = ""

for i in range(N):
    ans = ans + S[i]
    
print(ans)

Submission status: Accepted

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

li.sort()
ans = "".join(map(str, li))
print(ans)

Submission status: Accepted

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

n, l = rli()
s = []
for i in range(n):
    s.append(input())
s.sort()
print(pli(s))

Submission status: Accepted

Solution code:
nums = input().split()
N = int(nums[0])
L = int(nums[1])
s = []
for i in range(N):
    s.append(input())
sorteds = sorted(s)
ans = ''
for seq in sorteds:
    ans += seq
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! python3

N, L = [int(x) for x in input().strip().split(' ')]
S = []
for _ in range(N):
    S.append(input().strip())
S.sort()
print(''.join(S))

Submission status: Accepted

Solution code:

n, l = map(int, raw_input().split())
a = []
for i in xrange(n):
  a.append(raw_input())
a.sort()
print "".join(a)

Submission status: Accepted

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

res = sorted(S)

print("".join(res))

Submission status: Accepted

Solution code:
n, l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
for i in range(len(s)-1):
    for j in range(len(s)-1):
        if s[j] > s[j+1]:
            s[j], s[j+1] = s[j+1], s[j]
for i in s:
    print(i, end = "")

Submission status: Accepted

Solution code:
N,L = map(int, raw_input().split())
arr = [raw_input() for i in range(N)]
arr.sort()
print ''.join(arr)

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
nl = [int(i) for i in input().split(" ")]
str_list = []
for _ in range(nl[0]):
    str_list.append(input())

for word in sorted(str_list):
    print(word,end="")

print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n,l = map(int,raw_input().split())
s = ['']*n
ans = ''
for i in range(n):
    s[i] = raw_input()
s = sorted(s)
for i in range(n):
    ans += s[i]
print(ans)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
n, l = map(int, input().split())
s = [ input() for tmp in range(n) ]
s.sort()
print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input().split()[0])
s = [input() for i in [0]*n]
s.sort()
print("".join(s))

Submission status: Accepted

Solution code:
print("".join(sorted([input()for _ in[""]*int(input().split()[0])])))

Submission status: Accepted

Solution code:
print("".join(sorted([input()for _ in[""]*int(list(map(int,input().split()))[0])])))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

word.sort()

for i in range(n):
  sys.stdout.write(word[i])

print()

Submission status: Accepted

Solution code:
n, str_len = [int(e) for e in input().split()]
strs = [input() for _ in range(n)]


def main(n, str_len, strs):
    ordered_strs = sorted(strs)
    return ''.join(ordered_strs)


print(main(n, str_len, strs))

Submission status: Accepted

Solution code:
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n,l=[int(i) for i in input().split()]
s=[]
for i in range(n):
    s.append(input())
s.sort()
for i in s:
    sys.stdout.write(i)
print()

Submission status: Accepted

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

N, L = map(int, input().split())
ls = []

for _ in range(N):
    input_data = input()
    ls.append(input_data)

ls.sort()
print(''.join(ls))

Submission status: Accepted

Solution code:
# coding: utf-8;

def main():
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    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 = []

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

for i in range(n-1):
	for j in range(n-1,i,-1):
		if s[j-1] > s[j]:
			s[j],s[j-1] = s[j-1],s[j]

print(*s,sep='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n,l = list(map(int,input().split()))
    a = [input() for _ in range(n)]
    a.sort()
    return ''.join(a)



print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,l=map(int,raw_input().split())
d=[]
for i in range(n):
    d.append(raw_input())
d.sort()
ans=''
for i in d:
    ans+=i
print ans

Submission status: Accepted

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

Submission status: Accepted

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

#print(s)
s.sort()
#print(s)

for i in range(n):
    s[i] = "".join(s[i])
s = "".join(s)

print(s)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

N,L = map(int,sys.stdin.readline().split())
S = []
for i in xrange(N):
    S.append(sys.stdin.readline())

S.sort()
ret = ''
for s in S:
    ret += s[0:L]
print ret

Submission status: Accepted

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

Submission status: Accepted

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

S.sort()

str = ""

for s in S:
    str += s

print(str)

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)]
S.sort()
print("".join(S))

Submission status: Accepted

Solution code:
n, l = list(map(int, input().split()))
l = list()
while(n):
	l.append(input())
	n -= 1
l.sort()
print("".join(l))

Submission status: Accepted

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

a = sorted(a)
ans = ''
for i in a:
    ans += i
print ans

Submission status: Accepted

Solution code:


N, L = map(int, raw_input().split())
S = [raw_input() for _ in xrange(N)]
S.sort()
print ''.join([n for n in S])

Submission status: Accepted

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

# new_list = sorted(S, key=str.lower)
S.sort()

print ''.join([n for n in S])

Submission status: Accepted

Solution code:
import heapq
N, L = map(int, raw_input().split())
hq = []
for _ in xrange(N):
    s = raw_input()
    heapq.heappush(hq, s)
ans = ''
while len(hq) > 0:
    ans += heapq.heappop(hq)
print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,l=map(int,raw_input().split())
s=[raw_input() for _ in xrange(n)]
s.sort()
ans=""
for i in xrange(n):
    ans+=s[i]
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, L = map(int, raw_input().split())
print "".join(sorted([raw_input() for i in xrange(N)]))

Submission status: Accepted

Solution code:
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, l = reads()
    s = [input() for _ in range(n)]
    print(''.join(sorted(s)))

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print("".join(sorted([input() for x in range(list(map(int, input().split()))[0])])))

Submission status: Accepted

Solution code:
import sys
n, l = map(int, input().split())
lis = []

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

lis2 = sorted(lis)

for x in lis2:
    print(x, end="")
print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sort_Ss = sorted(Ss)
joined_Ss = ''.join(sort_Ss)

print joined_Ss

Submission status: Accepted

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


if __name__=="__main__":
    solve()

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,ll = map(int,raw_input().split())
var = []
i = 0
while (n > 0):

    var.append(raw_input())
    l = len(var[i])
    if l > ll:
        exit
    i = i + 1
    n = n - 1
var.sort()
print ''.join(var)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def solve():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    s.sort()
    print(''.join(s))


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import re
import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_input():
        # return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        n, l = IO_for_Contest.read_n_int(2)
        raw_s = []
        for x in range(n):
            raw_s.append(IO_for_Contest.read_line())
        return list(map(lambda x: x[0:l], raw_s))

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(
                int,
                re.split('\s+', IO_for_Contest.my_input().strip())))[: n]


def solve():
    a = IO_for_Contest.read_from_input()
    a.sort()
    print(''.join(a))

if __name__ == '__main__':
    # doctest.testmod()
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

word.sort()
print ''.join(word)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = ""
n, l = map(int, raw_input().split())
s = []
for i in xrange(0, n):
	s.append(raw_input())

s.sort()
for i in xrange(0, n):
	a = a +s[i]

print a

Submission status: Accepted

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

array.sort()

print ''.join(array)

Submission status: Accepted

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

for i in range(N-1):
    start = N - 1
    #print("start " + str(start))
    for j in range(start-i):
        #print(str(start-j-1) + " " + str(start-j))
        Left = String[start-j-1]
        Right = String[start-j]
        if Left > Right:
            String[start-j-1] = Right 
            String[start-j] = Left

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

Submission status: Accepted

Solution code:
import sys

def main(lines):
    print(''.join(sorted(lines.split())))

next(sys.stdin)
lines = ''
for line in sys.stdin:
    lines += line
main(lines)

Submission status: Accepted

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