12
I'm currently scanning a bunch of handwritten documents and converting them to .txt files. Since I have a terrible handwriting the .jpg->.txt converter converts some of my umlauts to the "normal" letter encased by '
Task
Write a program or a function that:
- Is given a string
- you can choose any I/O codepage as long as
- it supports the characters
AEIOUaeiouÄËÏÖÜäëïöü'.- combining diacriticals are prohibited
- the Input and Output codepages are the same.
- it supports the characters
- the input will (beside spaces) only contain printable characters from your codepage.
- There will only be one solution, thus things like
'a'e'won't appear
- There will only be one solution, thus things like
- you can choose any I/O codepage as long as
- Converts all characters in the following set
AEIOUaeioutoÄËÏÖÜäëïöü- If, and only if, they are surrounded by
'characters:- Example:
'a''e' -> äë
- Example:
- If the from string is a single letter.
- for example
'AE'does not change at all, outputting as-is.
- for example
- If the from character is not a character out of
AEIOUaeiouthat character won't change.
- If, and only if, they are surrounded by
Note: The from character / from string is the one between '.
Testcases
Input
Output
<empty line>
'A'sthetik
Ästhetik
Meinung ist wichtig!
Meinung ist wichtig!
Ich sagte: "Er sagte: 'Ich habe Hunger'"
Ich sagte: "Er sagte: 'Ich habe Hunger'"
Ich sagte: "Er sagte: ''A'sthetik'"
Ich sagte: "Er sagte: 'Ästhetik'"
Hämisch rieb er sich die H'a'nde
Hämisch rieb er sich die Hände
H'a''a'slich isn't a German word
Hääslich isn't a German word
since it's really called h'a'sslich
since it's really called hässlich
6The active ingredient in all of your testcases are either
'A'or'a'... not what I consider good testcases. – Leaky Nun – 2017-05-02T17:53:22.3301Can you add a example with
'w'(aswis not one ofAEIOUaeiou)? – jimmy23013 – 2017-05-02T18:07:20.1438
Combining diacriticals had unknown status, then were allowed, then were disallowed. This invalidated at least 4 answers. Boo! Hiss! I've changed my upvote to a downvote :(
– Digital Trauma – 2017-05-02T18:36:12.8071@DigitalTrauma I'm very sorry for that. – Roman Gräf – 2017-05-02T18:45:59.923
4Add testcase:
'q'e'd'– Display Name – 2017-05-03T05:57:30.4931What is with strings like
'a'u', this can result inäu,aüoräü, what of that is allowed what not? – 12431234123412341234123 – 2017-05-04T09:54:12.7571Isn't it häßlich? – Magic Octopus Urn – 2017-07-07T17:02:11.307
This says it is
hässlich. In the first example the error(?) is intended. – Roman Gräf – 2017-07-08T05:43:34.720