-
Notifications
You must be signed in to change notification settings - Fork 63
PALINGAM (AUG17) [PYTHON] #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi! Thanks for contributing to this repository. |
what is travis checking and why does it fail if my code passed all test cases? |
Add Spaces around Binary Operator. |
Duplicate of #200 ? |
2017/AUG/AUG17/PALINGAM/PALINGAM.py
Outdated
@@ -0,0 +1,37 @@ | |||
#Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
+++ b/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
@@ -1,4 +1,4 @@
-#Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
+# Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
t = input()
while ( t > 0 ) :
2017/AUG/AUG17/PALINGAM/PALINGAM.py
Outdated
a = raw_input() | ||
b = raw_input() | ||
|
||
na = len(a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: pep8
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
+++ b/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
@@ -1,37 +1,37 @@
#Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
t = input()
-while ( t > 0 ) :
- a = raw_input()
- b = raw_input()
-
- na = len(a)
- nb = len(b)
-
- lpa = []
- lpb = []
- for i in range(26):
- lpa.append(0)
- lpb.append(0)
- k2 = ord('a')
- for i in range(na):
- lpa[ ord( a[i] ) - k2 ] = lpa[ ord( a[i] ) - k2 ] + 1
- for i in range(nb):
- lpb[ ord( b[i] ) - k2 ] = lpb[ ord( b[i] ) - k2 ] + 1
- flag = 0
- c1 = 0
- c2 = 1
- for i in range(26):
- if ( lpa[i] >= 2 ) and (lpb[i] == 0 ):
- flag=1
- if ( lpa[i] != 0 ) and ( lpb[i] == 0 ):
- c1 = 1
- if( c1 == 1 ):
- for i in range(26):
- if ( lpb[i] != 0 ) and ( lpa[i] == 0 ):
- c2 = 0
- if ( flag == 1 ) or ( ( c1 == 1 ) and ( c2 == 1 ) ):
- print "A"
- else:
- print "B"
- t=t-1
+while (t > 0):
+ a = raw_input()
+ b = raw_input()
+
+ na = len(a)
+ nb = len(b)
+
+ lpa = []
+ lpb = []
+ for i in range(26):
+ lpa.append(0)
+ lpb.append(0)
+ k2 = ord('a')
+ for i in range(na):
+ lpa[ord(a[i]) - k2] = lpa[ord(a[i]) - k2] + 1
+ for i in range(nb):
+ lpb[ord(b[i]) - k2] = lpb[ord(b[i]) - k2] + 1
+ flag = 0
+ c1 = 0
+ c2 = 1
+ for i in range(26):
+ if (lpa[i] >= 2) and (lpb[i] == 0):
+ flag = 1
+ if (lpa[i] != 0) and (lpb[i] == 0):
+ c1 = 1
+ if(c1 == 1):
+ for i in range(26):
+ if (lpb[i] != 0) and (lpa[i] == 0):
+ c2 = 0
+ if (flag == 1) or ((c1 == 1) and (c2 == 1)):
+ print "A"
+ else:
+ print "B"
+ t = t-1
Fixes #212
Problem Code (Contest Code) [Language]
.