# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
#rahul
#0 2 4
#rhl
#au
# -

s = input('Enter some string')
print('Characters at even position:', s[::2])
print('Characters at odd position:', s[1::2])

s = input('Enter some string')
i = 0
print('The characters at even position')
while i < len(s):
    print(s[i], end=',')
    i = i+2
print()
print('The characters at odd position')
i=1
while i<len(s):
    print(s[i], end=',')
    i=i+2

# +
#input B4A1D3
#out ABD134
# -

s = input('Enter some string')
s1 = s2 = output = ''
for x in s:
    if x.isalpha():
        s1 = s1 + x
    else:
        s2 = s2 + x
print(s1)
print(s2)

s = input('Enter some string')
s1 = s2 = output = ''
for x in s:
    if x.isalpha():
        s1 = s1 + x
    else:
        s2 = s2 + x
for x in sorted(s1):
    output = output+x
for x in sorted(s2):
    output = output+x
print(output)

s = input('Enter some string')
s1 = s2 = output = ''
for x in s:
    if x.isalpha():
        s1 = s1 + x
    else: 
        s2 = s2 + x
output=s1+s2
print(sorted(output))

s = input('Enter some string')
s1 = s2 = output = ''
for x in s:
    if x.isalpha():
        s1 = s1 + x
    elif x.isdigit():
        s2 = s2 + x
for x in sorted(s1):
    output = output+x
for x in sorted(s2):
    output = output+x
print(output)

#input a4b3c2
#out aaaabbbcc
s = input('Enter some string')
output = ''
for x in s:
    if x.isalpha():
        output = output+x
        previous = x
    else:
        output = output + previous*(int(x)-1)
print(output)

# +
#input1 = 'Rahul'
#input2 = 'Rohit'
#output - RRaohhuilt
# -

s1 = input('Enter the 1st string')
s2 = input('Enter the 2nd string')
output = ''
i=j=0
while i<len(s1) or j<len(s2):
    output = output + s1[i] + s2[j]
    i = i+1
    j = j+1
print(output)

s1 = input('Enter 1st String')
s2 = input('Enter 2nd string')
output = ''
i=j=0
while i<len(s1) or j<len(s2):
    if i < len(s1):
        output = output + s1[i]
        i = i+1
    if j < len(s2):
        output = output + s2[j]
        j = j + 1
print(output)

StarcoderdataJupyterScriptsDedupFiltered