Skip to content

Commit

Permalink
Add unfinished solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Nov 30, 2024
1 parent 3bffd2a commit 76e5be2
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
55 changes: 55 additions & 0 deletions solutions/beecrowd/2866/2866.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

struct Stack {
char character;
struct Stack *next;
};

typedef struct Stack stack;

void push(stack **decrypted_string, char character) {
stack *new_item = (stack *)malloc(sizeof(stack));

new_item->character = character;
new_item->next = *decrypted_string;
*decrypted_string = new_item;
}

char pop(stack **decrypted_string) {
char character = (*decrypted_string)->character;
stack *temp = *decrypted_string;

*decrypted_string = (*decrypted_string)->next;
free(temp);
return character;
}

int main() {
int16_t c;
char character;
stack *decrypted_string = NULL;

scanf("%d", &c); // reads the number
character = getchar(); // reads the newline

character = getchar();

while (character != EOF) {
if (character != '\n') {
if (!isupper(character)) {
push(&decrypted_string, character);
}
} else {
while (decrypted_string != NULL) {
putchar(pop(&decrypted_string));
}
putchar('\n');
}
character = getchar();
}

return 0;
}
1 change: 1 addition & 0 deletions solutions/beecrowd/2866/2866.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main() {}
1 change: 1 addition & 0 deletions solutions/beecrowd/2866/WRONG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c

0 comments on commit 76e5be2

Please sign in to comment.