0% found this document useful (0 votes)
20 views2 pages

1

Uploaded by

Nikunj Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

1

Uploaded by

Nikunj Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import math

import os
import random
import re
import sys

#
# Complete the 'strmethod' function below.
#
# The function accepts following parameters:
# 1. STRING para
# 2. STRING spch1
# 3. STRING spch2
# 4. LIST li1
# 5. STRING strf
#

def stringmethod(para, special1, special2, list1, strfind):


# Write your code here

word1 = ""
for i in para:
if i not in special1:
word1 += i
else:
continue

n = 0
word2 = ""
for i in word1:
if n == 70:
break
else:
word2 += i
n += 1
rword2 = word2[::-1]
print(rword2)

ans1 = ""
for i in rword2:
if i == " ":
continue
else:
ans1 = ans1 + i + special2
ans1f = ans1[:len(ans1) - 1]
print(ans1f)

if all(x in para for x in list1):


print("Every string in {} were present".format(list1))
else:
print("Every string in {} were not present".format(list1))

ans2 = list(word1.split())
print(ans2[:20])

d = {}
for i in ans2:
if i in d:
d[i] += 1
else:
d[i] = 1
d1 = {}
for k, v in d.items():
if v < 3:
d1.update({k: v})
dr = dict(reversed(d1.items()))
c = 0
drf = {}
for k, v in dr.items():
if c == 20:
break
else:
drf.update({k: v})
c += 1
drfr = dict(reversed(drf.items()))
ldrfr = list(drfr.keys())
print(ldrfr)

if word1.find(strfind):
print(word1.rfind(strfind))
else:
print("Not found")

if __name__ == '__main__':
para = input()

spch1 = input()

spch2 = input()

qw1_count = int(input().strip())

qw1 = []

for _ in range(qw1_count):
qw1_item = input()
qw1.append(qw1_item)

strf = input()

stringmethod(para, spch1, spch2, qw1, strf)

You might also like