def dup_terms_gcd(f, K):
 if (dup_TC(f, K) or (not f)):
  return (0, f)
 i = 0
 for c in reversed(f):
  if (not c):
   i += 1
  else:
   break
 return (i, f[:(- i)])

def dup_terms_gcd ( f , K ) : if ( dup_TC ( f , K ) or ( not f ) ) : return ( 0 , f ) i = 0 for c in reversed ( f ) : if ( not c ) : i += 1 else : break return ( i , f [ : ( - i ) ] )
remove gcd of terms from f in k[x] .