add new tasks to the file
This commit is contained in:
parent
f61072a605
commit
20c90b023c
@ -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 (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)
|
Loading…
Reference in New Issue
Block a user