Skip to content

Commit c4d5bca

Browse files
committed
codechef-Learning DSA problems
1 parent 1b19ebf commit c4d5bca

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
while True:
2+
x = int(input())
3+
if x==42:
4+
break
5+
print (x)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
t = int(input())
2+
while t:
3+
test_string = input()
4+
middle_point = len(test_string)//2
5+
if len(test_string) % 2 == 0: # string length is even
6+
f_half = test_string[:middle_point]
7+
s_half = test_string[middle_point:]
8+
else:
9+
f_half = test_string[:middle_point]
10+
s_half = test_string[middle_point+1:]
11+
if sorted(f_half) == sorted(s_half):
12+
print('YES')
13+
else:
14+
print('NO')
15+
t -= 1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
t = int(input())
2+
while t:
3+
n = input()
4+
print(n[::-1])
5+
t-= 1

0 commit comments

Comments
 (0)