Moved kattis from Uni repo
This commit is contained in:
2
kattis/problems/11_11_23/ekkidaudi/1.in
Normal file
2
kattis/problems/11_11_23/ekkidaudi/1.in
Normal file
@ -0,0 +1,2 @@
|
||||
ho|lo
|
||||
pe|ve
|
2
kattis/problems/11_11_23/ekkidaudi/2.in
Normal file
2
kattis/problems/11_11_23/ekkidaudi/2.in
Normal file
@ -0,0 +1,2 @@
|
||||
ekki |daudi
|
||||
opna| inni
|
72
kattis/problems/11_11_23/ekkidaudi/main.c
Normal file
72
kattis/problems/11_11_23/ekkidaudi/main.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX 2100
|
||||
|
||||
int isAlpha(char c) {
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
return 1;
|
||||
}
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void printBefore(char first[MAX], char second[MAX]) {
|
||||
for (int i=0; i<strlen(first); i++) {
|
||||
if (first[i] == '|') {
|
||||
break;
|
||||
}
|
||||
if (isAlpha(first[i])) {
|
||||
printf("%c", first[i]);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<strlen(second); i++) {
|
||||
if (second[i] == '|') {
|
||||
break;
|
||||
}
|
||||
if (isAlpha(second[i])) {
|
||||
printf("%c", second[i]);
|
||||
}
|
||||
}
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
void printAfter(char first[MAX], char second[MAX]) {
|
||||
int pipeFound = 0;
|
||||
for (int i=0; i<strlen(first); i++) {
|
||||
if (pipeFound && isAlpha(first[i])) {
|
||||
printf("%c", first[i]);
|
||||
}
|
||||
if (first[i] == '|') {
|
||||
pipeFound = 1;
|
||||
}
|
||||
|
||||
}
|
||||
pipeFound = 0;
|
||||
for (int i=0; i<strlen(second); i++) {
|
||||
if (pipeFound && isAlpha(second[i])) {
|
||||
printf("%c", second[i]);
|
||||
}
|
||||
if (second[i] == '|') {
|
||||
pipeFound = 1;
|
||||
}
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
char first[MAX];
|
||||
char second[MAX];
|
||||
|
||||
scanf("%s %s", first, second);
|
||||
|
||||
printBefore(first, second);
|
||||
printAfter(first, second);
|
||||
|
||||
return 0;
|
||||
}
|
68
kattis/problems/11_11_23/ekkidaudi/main.c.orig
Normal file
68
kattis/problems/11_11_23/ekkidaudi/main.c.orig
Normal file
@ -0,0 +1,68 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX 2100
|
||||
|
||||
int isAlpha(char c) {
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
return 1;
|
||||
}
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void printBefore(char first[MAX], char second[MAX]) {
|
||||
for (int i=0; i<strlen(first); i++) {
|
||||
if (first[i] == '|') {
|
||||
break;
|
||||
}
|
||||
if (isAlpha(first[i])) printf("%c", first[i]);
|
||||
}
|
||||
for (int i=0; i<strlen(second); i++) {
|
||||
if (second[i] == '|') {
|
||||
break;
|
||||
}
|
||||
if (isAlpha(second[i])) printf("%c", second[i]);
|
||||
}
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
void printAfter(char first[MAX], char second[MAX]) {
|
||||
int pipeFound = 0;
|
||||
for (int i=0; i<strlen(first); i++) {
|
||||
if (pipeFound) {
|
||||
printf("%c", first[i]);
|
||||
}
|
||||
if (first[i] == '|' && isAlpha(first[i])) {
|
||||
pipeFound = 1;
|
||||
}
|
||||
|
||||
}
|
||||
pipeFound = 0;
|
||||
for (int i=0; i<strlen(second); i++) {
|
||||
if (pipeFound) {
|
||||
printf("%c", second[i]);
|
||||
}
|
||||
if (second[i] == '|' && isAlpha(second[i])) {
|
||||
pipeFound = 1;
|
||||
}
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
char first[MAX];
|
||||
char second[MAX];
|
||||
|
||||
scanf("%s %s", first, second);
|
||||
|
||||
printBefore(first, second);
|
||||
printAfter(first, second);
|
||||
|
||||
return 0;
|
||||
}
|
4
kattis/problems/11_11_23/ekkidaudi/main.py
Normal file
4
kattis/problems/11_11_23/ekkidaudi/main.py
Normal file
@ -0,0 +1,4 @@
|
||||
first = input().split("|")
|
||||
second = input().split("|")
|
||||
|
||||
print(first[0] + second[0] + " " + first[1] + second[1])
|
BIN
kattis/problems/11_11_23/ekkidaudi/program
Executable file
BIN
kattis/problems/11_11_23/ekkidaudi/program
Executable file
Binary file not shown.
Reference in New Issue
Block a user