Closed adityagupta26 closed 3 years ago
please specify
// CPP program to implement run length encoding
using namespace std;
void printRLE(string str) { int n = str.length(); for (int i = 0; i < n; i++) {
// Count occurrences of current character
int count = 1;
while (i < n - 1 && str[i] == str[i + 1]) {
count++;
i++;
}
// Print character and its count
cout << str[i] << count;
}
}
int main() { string str = "wwwwaaadexxxxxxywww"; printRLE(str); return 0; }
i am not able to commit request/pull request
ok i will add it. no worries
i will leave a code