There is currently a meme on the internet that consist of taking a sentence, reverse the meaning and adding
n't at the end. For example,
I am small becomes
I am talln't
For the sake of the challenge, we'll simplify this : Your task will be to detect whenever there is a negation in a sentence, and replace it with the 'positive' one with
n't added at the end. There will be some tricky parts that will be explained in the rules.
- You have to take a String as input, and return a String as output.
- Input will be a sentence in lowercase, with only
,as punctuation marks.
- You have to replace any
nothave to be a word and not a substring : you don't have to change anything in
none of those
- If the word already finish with a
n, you have to replace
notisn't followed by any word, a punctuation mark or another
not, you have to replace it with
- compound words count as one word. so even if
no-opcontain the substring
no, it doesn't contain the word no. So the result will be
- You do not have to worry about grammar errors. For example,
there is no waywill result to
there is wayn't.
- No standard loopholes allowed.
- This is codegolf, so the shortest code wins.
There are some examples, even if this challenge looks clearn't for now.
Input : i love codegolfing, but i do not like short programs. does this sentence makes sense ... of course no.
Output : i love codegolfing, but i do liken't short programs. does this sentence makes sense ... of course yesn't.
Input : you are not invited. get out.
Output : you are invitedn't. get out.
Input : i am not ok, i have no plan and i have no gunn
Output : i am okn't, i have plan't and i have gunn't
Input : oh no no no i refuse.
Output : oh yesn't yesn't in't refuse.
Input : oh no no no, i refuse.
Output : oh yesn't yesn't yesn't, i refuse.
Input : i cannot believe this, you can't codegolf.
Output : i cannot believe this, you can't codegolf.
Input : oh no ... he did it again.
Output : oh yesn't ... he did it again.
Input : nn't is not a word, kevin. so this is not nn't.
Output : nn't is an't word, kevin. so this is nn'tn't.
Input : is it not clearn't for everyone
Output : is this clearn'tn't for everyone
Input : this is non't sense ...
Output : this is non't sense ...