题解 | #计算某字符出现次数#
计算某字符出现次数
http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
while True:
try:
n=0
ss=list(input().strip())
s=input().strip()
m=ord(s)
if m<65 or m>97+25 or 97>m>90:
n=0
for i in ss:
if s==i:
n+=1
elif 65<=m<=90:
n=0
for i in ss:
if s==i or chr(m+32)==i:
n+=1
elif 97<=m<=97+25:
n=0
for i in ss:
if s==i or chr(m-32)==i:
n+=1
print(n)
except:
break
try:
n=0
ss=list(input().strip())
s=input().strip()
m=ord(s)
if m<65 or m>97+25 or 97>m>90:
n=0
for i in ss:
if s==i:
n+=1
elif 65<=m<=90:
n=0
for i in ss:
if s==i or chr(m+32)==i:
n+=1
elif 97<=m<=97+25:
n=0
for i in ss:
if s==i or chr(m-32)==i:
n+=1
print(n)
except:
break