Skip to content

Commit 76e5be2

Browse files
committed
Add unfinished solutions
1 parent 3bffd2a commit 76e5be2

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

solutions/beecrowd/2866/2866.c

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include <ctype.h>
2+
#include <stdint.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
5+
6+
struct Stack {
7+
char character;
8+
struct Stack *next;
9+
};
10+
11+
typedef struct Stack stack;
12+
13+
void push(stack **decrypted_string, char character) {
14+
stack *new_item = (stack *)malloc(sizeof(stack));
15+
16+
new_item->character = character;
17+
new_item->next = *decrypted_string;
18+
*decrypted_string = new_item;
19+
}
20+
21+
char pop(stack **decrypted_string) {
22+
char character = (*decrypted_string)->character;
23+
stack *temp = *decrypted_string;
24+
25+
*decrypted_string = (*decrypted_string)->next;
26+
free(temp);
27+
return character;
28+
}
29+
30+
int main() {
31+
int16_t c;
32+
char character;
33+
stack *decrypted_string = NULL;
34+
35+
scanf("%d", &c); // reads the number
36+
character = getchar(); // reads the newline
37+
38+
character = getchar();
39+
40+
while (character != EOF) {
41+
if (character != '\n') {
42+
if (!isupper(character)) {
43+
push(&decrypted_string, character);
44+
}
45+
} else {
46+
while (decrypted_string != NULL) {
47+
putchar(pop(&decrypted_string));
48+
}
49+
putchar('\n');
50+
}
51+
character = getchar();
52+
}
53+
54+
return 0;
55+
}

solutions/beecrowd/2866/2866.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int main() {}

solutions/beecrowd/2866/WRONG

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c

0 commit comments

Comments
 (0)