Wipro Coding
Wipro Coding
S=input()
res=""
for i in range(0,len(S)-1,2):
if ord(S[i])>ord(S[i+1]):
res+=S[i]
else:
res+=S[i+1]
if len(S)%2!=0:
res+=S[-1]
print(res)
#credit score
N=int(input())
lst=list(map(int,input().split()))
lst.sort()
mi=lst[-1]*lst[-2]
for i in range(N-1):
for j in range(i+1,N):
k=lst[i]*lst[j]
if k<mi:
mi=k
a=lst[i]
b=lst[j]
print(b+a)
#perfect match
n=int(input())
k=int(input())
arr=list(map(int,input().split()))
res=[]
for i in arr:
r=i%k
res.append(r)
print(sum(res))
#cat lex
str=input()
x=int(input())
l=[]
counts = {}
words = str.split()
for word in words:
if word in counts:
counts[word] += 1
else:
counts[word] = 1
for k,v in counts.items():
if counts[k]>=x:
l.append(k)
l.sort()
print(" ".join(l))
#Company product code
n=int(input())
arr=list(map(int,input().split()))
counts = {}
for i in arr:
if i in counts:
counts[i] += 1
else:
counts[i] = 1
max1=min1=s=t=0
for k,v in counts.items():
if counts[k]>=max1:
max1=counts[k]
t=k
if counts[k]<=min1:
min1=counts[k]
s=k
print(t-s)
#climate code
n,l,r=map(int,input().split())
arr=list(map(int,input().split()))
for i in arr:
if (i>l) or (i<r):
print(i,end=" ")
#prime and n prime
n=int(input())
flag=0
p=[]
np=[]
arr=list(map(int,input().split()))
for i in arr:
for k in range(2, i):
if (i % k) == 0:
flag = 1
break
if flag==1:
np.append(i)
else:
p.append(i)
flag=0
for i in p:
print(i,end=" ")
for i in np:
print(i,end=" ")
#decimal to binary
n=int(input())
y=1
bin=0
while(n>0):
x=n%2
bin=bin+x*y
n=n//2
y=y*10
print(bin)
#apparal code
n=int(input())
if (n >= 2) and (n<=1000000):
arr=list(map(int,input().split()))
arr.sort()
print(arr[-1]+arr[-2])
s=input()
max=min=ord(s[0])
for i in range(0,len(s)):
if ord(s[i])> max:
max=ord(s[i])
if ord(s[i])< min:
min=ord(s[i])
print(min,max)
m=input()
l=len(m)
a=[]
for k in m:
a.append(int(k))
n=int(m)
print(a)
if n>0 and n<= 100000:
if n%2==0:
for i in range(0,l-1,2):
temp=a[i]
a[i]=a[i+1]
a[i+1]=temp
else:
for i in range(0,l-2,2):
temp=a[i]
a[i]=a[i+1]
a[i+1]=temp
i=i+1
for i in a:
print(i,end="")
#Gamming hub
n=int(input())
l=list(map(int,input().split()))
k,j=map(int,input().split())
c=0
for a in l:
if ((k%a==0) and (j%a==0)):
c=c+1
if n>0 and n<=1000:
if k>=0 and k<=1000 and j>=0 and j<=1000:
print(c)
#Rating problem
#include <stdio.h>
int main()
{
int p;
scanf("%d",&p);
if ((p>=30) && (p<=50))
printf("Average");
if ((p>=51) && (p<=60))
printf("Good");
if ((p>=61) && (p<=80))
printf("Excellent");
if ((p>=81) && (p<=100))
printf("Outstanding");
return 0;
}
online test
n=int(input())
s=0
m=0
a=0
while(n>0):
x=n%10
s=s+x
n=n//10
if s<=26:
s=s+ord("A")
print(chr(s)-1)
else:
print(s)
while(s>0):
a=s%10
m=m+a
s=s//10
print(chr(m+ord("A")-1))
cosmotic
n=int(input())
l="abcdefghij"
s=""
if n>=0 and n<=1000000:
while(n>0):
x=n%10
s=s+l[x]
n=n//10
print(s[::-1])
s=input()
c=0
for i in s:
if i.isnumeric():
c=c+1
print(c)
n=int(input())
l=list(map(int,input().split()))
s=sum(l)
m=0
if(round(s**(1/3))**3==s):
print("Yes")
else:
for i in range(0,100000):
if(s>(i**3)):
continue
else:
m=i
break
print((m**3)-s)
#lucky loterry
n=int(input())
l=list(map(int,input().split()))
max1=0
for i in l:
if max1 <l.count(i):
max1=i
maxn=i
print(maxn)
if(len(m)%2!=0):
x=x+m[-1]
print(x)
n=int(input())
l1=[]
l2=[]
l3=[]
l=list(map(int,input().split()))
a,b=map(int,input().split())
print(l,a,b)
l1=l[0:a]
l2=l[a:b+1]
if b<n:
l3=l[b+1:len(l)]
l4=l1+l2[::-1]+l3
print(l4)
for i in l4:
print(i,end=" ")
lis=[int(digit) for digit in str(number)]
n=int(input())
a,b,c=list(map(int,input().split()))
maxa1=0
maxa2=0
while(a>0):
x=a%10
if maxa1<x:
maxa2=maxa1
maxa1=x
a=a//10
while(b>0):
x=b%10
if maxb1<x:
maxb2=maxb1
maxb1=x
b=b//10
while(c>0):
x=c%10
if maxc1<x:
maxc2=maxc1
maxc1=x
c=c//10
n=int(input())
k=int(input())
l=list(map(int,input().split()))
s=0
for i in l:
if i>= 0 and i<=1000000:
x=i%k
s=s+x
print(s)
n=int(input())
min1=0
while(a>0):
x=a%10
if min1>x:
min1=x
a=a//10
print(min1)
#encryption
k=int(input())
s=input()
for i in s:
print(chr(ord(i)+k),end="")
n=int(input())
ev=0
if n>0 and n<=1000000000:
while(n>0):
x=n%10
if x%2==0:
ev=ev+1
n=n//10
print(ev)
n=input()
max1=0
min1=100000
for i in n:
if ord(i) > max1:
max1=ord(i)
if ord(i)<min1:
min1=ord(i)
print(max1+min1)
#bucket id
n=int(input())
l=[]
while n>0:
x=n%10
l.append(x)
n=n//10
ks=""
km=""
k=sorted(l,reverse=True)
for i in k:
ks=ks+str(i)
m=sorted(l,reverse=False)
for i in m:
km=km+str(i)
print(int(ks)+int(km))
#container
n=int(input())
l=list(map(int,input().split()))
k=sorted(l)
j=len(k)-1
print(k)
m=0
for i in range(0,len(k),2):
print(k[j],k[m])
print()
j=j-1
m=m+1
#players
n=int(input())
l=list(map(int,input().split()))
a,b=map(int,input().split())
c=0
for k in l:
if a%k==0 and b%k==0:
c=c+1
if n>0 and n<=1000:
print(c)
fibonacci
nterms = int(input())
n1, n2 = 0, 1
count = 0
s=0
if nterms >= 0 and nterms<=100000:
if nterms == 1:
print(n1)
else:
while count < nterms:
s=s+n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
print(s)
#reverse differnce
n=int(input())
k=n
rev=0
while n>0:
x=n%10
rev=rev*10+x
n=n//10
print(n-rev)
#aAklip
N=input()
lst=[]
for i in N:
lst.append(ord(i))
print(max(lst)+min(lst))
#Apparal code
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr.sort()
print(arr[-k])
#today apparal
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in arr:
if i>=0:
c=c+1
print(c)
#prime numbers
#include <stdio.h>
int main()
{
int i, Number, count,k;
scanf("%d",&k);
for(Number = 1; Number <= k; Number++)
{
count = 0;
for (i = 2; i <= Number/2; i++)
{
if(Number%i == 0)
{
count++;
break;
}
}
if(count == 0 && Number != 1 )
{
printf(" %d ", Number);
}
}
return 0;
}