The problem will give you mutiple lists of data and mutiple commands. Each data will be stored in one node,
the new data will be inserted to the head of the list.
There will be 4 kinds of commands :
strlen(data) <= 20
numbers of all commands <= 40
numbers of RA/DA commands <= 10
max list length <= 10^5
Hint:
character array copy
#include <string.h>
char * strncpy ( char * destination, const char * source, size_t num );
you don't have to follow this Architecture, it's just a hint
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _Node {
char data[21];
struct _Node *next;
struct _Node *prev;
} Node;
int main()
{
int times;
char cmd[3];
scanf("%d",×);
while(times--)
{
scanf("%s", cmd);
if(strncmp (cmd,"I",2)==0)
{
}
else if(strncmp (cmd,"RA",2)==0)
{
}
else if(strncmp (cmd,"DA",2)==0)
{
}
else if(strncmp (cmd,"S",2)==0)
{
}
}
return 0;
}
First line will contain one integer inplying how many command will be constructed
Following line will be the input instruction
Every output will be seperated by a blank.