Witam,
Potrzebuję pomocy w zadaniu http://pl.spoj.com/problems/FLAMASTE/, wszystko kompiluje, wynik wychodzi poprawny ale SPOJ wywala "błędna odpowiedź"
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
int ile;
unsigned int pozycja=1;
cin >> ile;
string *tab = new string [ile];
for(int i=0; i<ile; i++)
cin >> tab[i];
string testowy, nowychar;
for(int i=0; i<ile; i++)
{
testowy=tab[i][0];
for(int w=0; w<tab[i].length(); w++)
{
if(tab[i][w]!=tab[i][w+1])
{
if(pozycja>2)
{
ostringstream ss;
ss << pozycja;
nowychar = ss.str();
testowy=testowy+nowychar;
pozycja=1;
}
else if (pozycja==2)
{
testowy=testowy+tab[i][w];
pozycja=1;
}
testowy=testowy+tab[i][w+1];
}
else
{
pozycja++;
}
}
tab[i]=testowy;
}
for(int i=0; i<ile; i++) cout << tab[i] << endl;
return 0;
}