Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 14f9c94

Browse files
Create Making-Anagram.py
1 parent 74a5690 commit 14f9c94

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎String/Making-Anagram.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the makingAnagrams function below.
10+
def makingAnagrams(s1, s2):
11+
s11=[i for i in s1]
12+
s22=[i for i in s2]
13+
count=0
14+
for i in range(0,len(s11)):
15+
if s11[i] in s22:
16+
s22.remove(s11[i])
17+
count+=1
18+
return int(len(s11)+len(s22))-count
19+
20+
if __name__ == '__main__':
21+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
22+
23+
s1 = input()
24+
25+
s2 = input()
26+
27+
result = makingAnagrams(s1, s2)
28+
29+
fptr.write(str(result) + '\n')
30+
31+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /