SHARE
TWEET

BA2C

a guest Mar 20th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #BA2C
  2. s=raw_input()
  3. k=input()
  4. w=k
  5. h=4
  6. profile = [[0 for x in range(w)] for y in range(h)]
  7.  
  8. for i in range(0,h):
  9.     for j in range(0,w):
  10.         n = float(raw_input())
  11.         profile[i][j]=n
  12.  
  13.  
  14. def proCount(key):
  15.     ans=1
  16.     #print key
  17.     for i in range(len(key)):
  18.         if key[i]=='A':
  19.             ans=ans*profile[0][i]
  20.         if key[i]=='C':
  21.             ans=ans*profile[1][i]
  22.         if key[i]=='G':
  23.             ans=ans*profile[2][i]
  24.         if key[i]=='T':
  25.             ans=ans*profile[3][i]
  26.         #ans*=profile[][]
  27.         #print key[i]
  28.     #print ans
  29.     return ans
  30.  
  31. array={}
  32.  
  33. for i in range(len(s)-k+1):
  34.     #print s[i:i+k]
  35.     if s[i:i+k] not in array:
  36.         array[s[i:i+k]]=0
  37.  
  38. for key,val in array.items():
  39.     #print key,' ',val
  40.     array[key]=proCount(key)
  41.  
  42. m = max(array.values())
  43.  
  44. #print m
  45.  
  46. for key,val in array.items():
  47.     if val==m:
  48.         print key
  49.         break
RAW Paste Data
Top