// Online C compiler to run C program online
#include <stdio.h>
#include <string.h>

void process(char *b, int size){
  static char buffer[512];
  static int count = 0;

  char tmp[128];
  int i;

  memcpy(buffer + count, b, size);
  count += size;

  int start = 0;
  for (i = 0; i < count; i++){
    if (buffer[i] == '\n'){
      memcpy(tmp, buffer + start, i - start);
      tmp[i-start] = 0;
      //String s(tmp);
      //Serial.println(s);
      printf("%s\n",tmp);
      start = i + 1;
    }
  }

  for (i = start; i < count; i++){
    buffer[i - start] = buffer[start];
  }

  count = count - start;
}

int main() {
    char s1[] = "{'address':'24:58:7c:d3:87:de', 'rssi':-83, 'man_data':'2A', 'tick': 9224887823}\n{'address':'24:58:7c:d3:87:de', 'rssi':-84, ";
    char s2[] = "aaa\nbbb";
    char s3[] = "ccc\nddd\n";
    // Write C code here
    //printf("Try programiz.pro");
    process(s1, strlen(s1));
    process(s2, strlen(s2));
    process(s3, strlen(s3));

    return 0;
}