Something like this I presume:
1) search and read for a ini-topic
2) read an (string) ini-values of a that ini-topic.
3) search where the ampersand is in the string
4) compare it with the ampersands in the array
5) if not found, store it in the array
6) if found, show it
7) repeat from (2) until you got all ini-values of a certain ini-topic
8) clear the array.
9) proceed with the next topic (1) until every topic has been handled
10) print "hello world"