TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
manikandan r
NA
358
0
how to find a repeated characters in a Word
Mar 18 2021 1:12 AM
write a function to find repeated characters in a Word and then add "$" symbol like below
input - hellow output - he$l$low
Reply
Answers (
1
)
1
Sachin Singh
8
55.8k
84k
Mar 18 2021 7:22 AM
This is very easy to achieve, just think in terms of characters
static
void
Main(string[] args)
{
string input =
"hellow"
;
string input1 = null;
var arr = input.ToCharArray();
foreach(
char
c in arr)
{
if
(input.Count(x=>x==c)>=2)
{
input1 = input.Replace(c.ToString(),
"$"
+ c.ToString());
}
}
Console.WriteLine(input1);
Console.ReadLine();
}
Accepted Answer
How can I upload images in my blogs in Csharp Corner?
image to binary