Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <cstdio>
using namespace std;
int main(int argc, char** argv) {
printf("[");
char* cur = argv[1];
int count = 1;
for (;*cur;++cur, ++count) {
if (cur[0] != cur[1]) {
printf("(\"%c\", %ld)%s", cur[0], count, cur[1] ? " ,": "");
count=0;
}
}
printf("]\n");
}
print('[("a", 4), ("b", 3), ("c", 2), ("a", 1)]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment