add new tasks to the file

This commit is contained in:
Yesen 2023-10-06 22:05:26 +03:00
parent f61072a605
commit 20c90b023c

View File

@ -1,8 +1,31 @@
# процентное соотношение букв в строке
S = input().lower()
print (S)
# print (S)
g = S.count("g")
print (g)
# print (g)
c = S.count("c")
print (g)
print (((int(g)+int(c))/len(S))*100)
# print (g)
print (((int(g)+int(c))/len(S))*100)
# то же, но написать сколько встречается букв
s = str(input())
l = len(s)-1
c = 1
t = ''
if len(s)==1:
t = t +s+str(c)
else:
for i in range(0,l):
if s[i]==s[i+1]:
c +=1
elif s[i]!=s[i+1]:
t = t + s[i]+str(c)
c = 1
for j in range(l,l+1):
if s[-1]==s[-2]:
t = t +s[j]+str(c)
elif s[-1]!=s[-2]:
t = t +s[j]+str(c)
c = 1
print(t)