The algorithm you've presented operates in a time proportional to the lengths of the strings multiplied together, which might be O(n^2) (I don't know a lot about O() representation so that could be way off).
What you could do to improve matters is to run through the first string storing the number of times a particular character has occurred in a 26-number array (storing either the count or just whether or not a letter has been encountered, whichever is more relevant). Then just loop through the second string checking the array if that letter has been encountered.
for (i=0; i<26; flags[i++]=0) ;
for (i=0; str1[i]; i++)
if (str1[i]>='a' && str1[i]<='z') flags[str1[i]-'a']=1;
for (i=0; str2[i]; i++)
if (str2[i]>='a' && str2[i]<='z' && flags[str2[i]-'a'])
This should operate in O(n) time (if I'm correct about O() theory) because it operates in a time proportional to the lengths of the strings added together.
Output of the above is "ol".