Statistics string specified number of characters

Enter a string and a character, count the number of the characters that appear in the string

Input formats:

Enter two lines. Line 1 is the string, the second line is the character you want to find.

Output formats:

The number of characters that appear

Sample input:

abcdefgabcdefg
a
 

Sample output:

2
a=input()
b=input()
def CountAa(s):
    return s.lower().count(b)

if __name__ == "__main__":
    s = a
    print(CountAa(s))

  

Guess you like

Origin www.cnblogs.com/SkystarX/p/12334052.html