Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Easy]hyphen

 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This one is quite easy.Actually subproblem from one programming competition.
Input: any String(containing combination of letters from a to z)
Output:String array,each string contains hyphen at different position
example:1) Input :a
output:-a,a-
2)Input aqw
output: -aqw,a-qw,aq-w,aqw-
Write a program.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ October 07, 2004: Message edited by: Michael Dunn ]
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.I never thought of StringBuffer
 
Luis F Garcia
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there !!

I know I'm late, I just registered and hadn't seen this forum...

Hope you like this one:



Cheers !!
Luis F
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I checked all above three ways for different inputs.and checked the CPU usage and execution time.They are almost same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic