fast i/o for string

what is the fastest method to take string as input?

char str[size]

  1. cin>>str;(slowest)
  2. scanf("%s",str)(faster than 1)
  3. gets(str)(faster than 2)
  4. getchar_unloced()(fastest) read character by character

i hve googled it several times… iam not getting its proper implementation in the code… iam getting errors which iam unable to resolve