diff --git a/Python/ch2.String/hard_counting.py b/Python/ch2.String/hard_counting.py new file mode 100644 index 0000000..e52d2fc --- /dev/null +++ b/Python/ch2.String/hard_counting.py @@ -0,0 +1 @@ +print(f'{int(input()):b}'.count('1')) \ No newline at end of file diff --git a/Python/ch2.String/pass.py b/Python/ch2.String/pass.py new file mode 100644 index 0000000..e5f90f9 --- /dev/null +++ b/Python/ch2.String/pass.py @@ -0,0 +1,8 @@ +k = int(input()) +password = input() +def co(ch, s): + i = s.find(ch) + return min(i , len(s) - i) +res = 0 +for i in range(k): res += co(password[i] , input()) +print(res) \ No newline at end of file