- csa->MakeStatic();
-
- text = csa->GetText(0);
- cout << "Text 0: \"" << text << "\"" << endl;
- delete [] text;
- text = csa->GetText(1);
- cout << "Text 1: \"" << text << "\"" << endl;
- delete [] text;
- text = csa->GetText(2);
- cout << "Text 2: \"" << text << "\"" << endl;
- delete [] text;
-
- text = csa->GetText(2, 2, 4);
- cout << "Substring of Text 3: \"" << text << "\"" << endl;
- delete [] text;
-
- printf("n:o contains: %u\n", csa->CountContains((uchar *)"ac"));
- printf("n:o suffix: %u\n", csa->CountSuffix((uchar *)"b"));
- printf("n:o equal: %u\n", csa->CountEqual((uchar *)"acabab"));
- printf("is equal: %u\n", csa->IsEqual((uchar *)"abacb"));
+
+ while (not(cin.eof())){
+ getline(cin,str); // Read line by line.
+// cin >> str; // Read word by word.
+ data = (uchar *) str.c_str();
+ csa->InsertText(data);
+ i++;
+ j+= str.size();
+ str.clear();
+ if ( i % 1000 == 0) {
+ std::cerr << "Inserted : " << i << " strings\n";
+ std::cerr << "Number of bytes inserted : " << j << "b \n";
+ std::cerr << "Heap usage used for strings: " << HeapProfiler::GetHeapConsumption() - heap_base
+ << "bytes\n";
+ std::cerr << "Ratio is : " << (float) (HeapProfiler::GetHeapConsumption() - heap_base) / ((float) j) <<"\n";
+
+ };