Moved kattis from Uni repo

This commit is contained in:
2023-12-01 13:35:13 +01:00
parent 28a6b807a3
commit aaa2c123b8
164 changed files with 3008 additions and 0 deletions

View File

@ -0,0 +1,2 @@
ho|lo
pe|ve

View File

@ -0,0 +1,2 @@
ekki |daudi
opna| inni

View 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;
}

View 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;
}

View File

@ -0,0 +1,4 @@
first = input().split("|")
second = input().split("|")
print(first[0] + second[0] + " " + first[1] + second[1])

Binary file not shown.