Latest News

Thursday, 12 February 2015

My SPOJ Solutions

Website developed/managed by prakhar thapak



























ABSYS

Following is the python code that works good for the problem 


tst = int(raw_input())
to_find="machula"
for i in range(tst):
r=raw_input()
t=raw_input()
index=t.find(to_find)
if (index+6)!=(len(t)-1):
t=t[:index] + "12" +t[index+7:]
else:
t=t[:index] + "12"
equal_to=t.find("=")
plus=t.find("+")
s=t.split(" ")
number1=int(s[0])
number2=int(s[2])
number3=int(s[4])
if index<plus:
number1=number3-number2
elif index>equal_to:
number3=number1+number2
else:
number2=number3-number1
print str(number1),"+",str(number2),"=",str(number3) 

Rishabh jain 6.4




  • Assassin Survivor Comments
  • Facebook Comments

0 comments:

Post a Comment

Item Reviewed: My SPOJ Solutions Description: Rating: 5 Reviewed By: Unknown
Scroll to Top