LIST class provides you the get method, but there is no get method in SET. As SET is an unordered collection, it is not certain to get the correct element in correct index.
The solution to this problem is, Cast the SET to LIST.
SET<String> str = new Set<String>();
string f = (new list<string>(str) );
string s = (new list<string>(str) );
You can get the element by index by this way.