1
Name:
Anonymous
2009-02-12 14:43
Can someone help me write a Java program that does this?
It simply changes the word "hate" to "love"
Enter a sentence containing the word "hate":
hate is such a strong word
Your revised sentence is:
love is such a strong word
3
Name:
Anonymous
2009-02-12 15:06
print qq{Enter a sentence containing the word "hate":\n};
(my $word=<>)=~s/hate/love/g;
print qq{\nYour revised sentence is:\n$word\n};
Enjoy
4
Name:
Anonymous
2009-02-12 15:11
replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace [] _ _ = []
replace s find repl | take (length find) s == find = repl ++ (replace (drop (length find) s) find repl)
| otherwise = [head s] ++ (replace (tail s) find repl)
main = putStrLn $replace "hate is such a strong word" "hate" "love"
7
Name:
Anonymous
2009-02-12 15:22
>>3
>>4
could you please elaborate on these?
8
Name:
Anonymous
2009-02-12 15:23
>>7
What seems to be the problem?
9
Name:
Anonymous
2009-02-12 15:24
>>7
What seems to be the officer?
18
Name:
Anonymous
2009-02-12 16:27
OP here. Nevermind, I figured it out.
19
Name:
Anonymous
2009-02-12 16:28
char* is considered harmful in any program written after 2000. Use either wchar_t or wstring .
20
Name:
Anonymous
2009-02-12 16:31
>>19
What do you mean by "harmful?"
21
Name:
Anonymous
2009-02-12 16:33
>>20
Adj. causing or tending to cause harm, esp. to a person's health
24
Name:
Anonymous
2009-02-12 16:43
>>19
If you don't need unicode support, or need to interoperate with libraries/applications which use plain ASCIIZ representation, char* just fits the job, and char by itself is nothing more than a signed byte.
25
Name:
Anonymous
2009-02-12 18:08
>>24
Signed? Why is char signed?
26
Name:
Anonymous
2009-02-12 19:15
op here,
will someone please give me the code already?
28
Name:
Anonymous
2009-02-12 19:18
>>26
Do your own homework, for fuck's sake this is retardedly simple.
30
Name:
Anonymous
2009-02-12 19:36
Pattern.compile("hate").matcher("hate is such a strong word").replaceAll("love"); now GET OUT
32
Name:
Anonymous
2009-02-12 20:27
>>30
I hope you're proud of yourself.
34
Name:
Anonymous
2009-02-12 22:31
public static String TransformHateToLove(String inText)
throws TextTransformException
{
TextTransform<String> hateToLoveTransform = TextTransformFactory.getInstance().createUserSpecifiedTextTranform<String>(TextTransformTypeFactory.getInstance().transformType(TextTransformTypes.TEXT_TRANSFORM_REPLACE|TextTransformTypes.TEXT_TRANFORM_CULTURE_INVARIANT),new CultureInvariantTextTransformAdapter<string>(new TextTransformInputStream<string>(inText),new TextTransformOutputStream<string>(),new TextTransformSourcePattern("hate",TextTransformSourcePattern.TEXT_TRANSFORM_PATTERN_INVARIANT),new TextTransformSinkPattern("love",TextTransformSinkPattern.TEXT_TRANSFORM_PATTERN_INVARIANT)));
return hateToLoveTransform.execute();
}
35
Name:
Anonymous
2009-02-12 22:52
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $292, %esp
movl %gs:20, %eax
movl %eax, -8(%ebp)
xorl %eax, %eax
jmp .L2
.L3:
leal -264(%ebp), %eax
movl %eax, (%esp)
call love
.L2:
movl $255, 8(%esp)
leal -264(%ebp), %eax
movl %eax, 4(%esp)
movl $0, (%esp)
call read
testl %eax, %eax
jg .L3
movl $0, %eax
movl -8(%ebp), %edx
xorl %gs:20, %edx
je .L6
call __stack_chk_fail
.L6:
addl $292, %esp
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.section .rodata
.LC0:
.string "love"
.text
.globl love
.type love, @function
love:
pushl %ebp
movl %esp, %ebp
subl $40, %esp
movl $0, -8(%ebp)
movl .LC0, %eax
movl %eax, -12(%ebp)
jmp .L8
.L9:
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $72, %al
je .L10
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $104, %al
jne .L12
.L10:
addl $1, 8(%ebp)
addl $1, -8(%ebp)
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $65, %al
je .L13
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $97, %al
jne .L8
.L13:
addl $1, 8(%ebp)
addl $1, -8(%ebp)
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $84, %al
je .L16
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $116, %al
jne .L8
.L16:
addl $1, 8(%ebp)
addl $1, -8(%ebp)
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $69, %al
je .L18
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $101, %al
jne .L8
.L18:
movl $0, -4(%ebp)
subl $3, 8(%ebp)
jmp .L20
.L21:
movl -4(%ebp), %eax
movzbl -12(%ebp,%eax), %edx
movl 8(%ebp), %eax
movb %dl, (%eax)
addl $1, -4(%ebp)
addl $1, 8(%ebp)
.L20:
cmpl $3, -4(%ebp)
jle .L21
addl $1, -8(%ebp)
jmp .L8
.L12:
addl $1, 8(%ebp)
addl $1, -8(%ebp)
.L8:
movl 8(%ebp), %eax
movzbl (%eax), %eax
cmpb $10, %al
jne .L9
movl -8(%ebp), %eax
subl %eax, 8(%ebp)
movl -8(%ebp), %eax
addl $1, %eax
movl %eax, 8(%esp)
movl 8(%ebp), %eax
movl %eax, 4(%esp)
movl $1, (%esp)
call write
leave
ret
40
Name:
Anonymous
2009-02-13 2:09
>>39
Its very happy gay GUI's.
41
Name:
Anonymous
2009-02-13 2:11
public static String loveToHate(String text) {
return text.replaceAll("love","hate");
}
43
Name:
Anonymous
2009-02-13 13:25
>>34
if you make this code readable and less complicated i will blow you.
45
Name:
Anonymous
2009-02-13 20:13
>>44
_\x81?loveu\xF8\xC7\x47hate\xEB\xF0
46
Name:
Anonymous
2009-02-13 20:16
>>45
lol, forgot my G.
But then the jump addresses will be wrong ;_;
47
Name:
Anonymous
2009-03-06 10:29
Is the way to make a useless and stupid endeavor Aside from random import choice randint def randsent x.