- def yasuo(str1):
- list1=list(str1);
- len1=len(list1);
- for s in list1:
- n=0;
- for i in range(len1):
- if(list1[i]==s):
- n+=1;
- list1[i]=’ ‘;
- if(s==’ ‘):
- continue;
- else:
- print(s,n,end=”,sep=”)
- str3=input(‘輸入一個’);
- yasuo(str3);
-
轉載:https://blog.csdn.net/ybp1137287436/article/details/79479249