0

Print the First Non Repeated Character

Get the input string from the user and print the first non repeating character in the string. if there is no Non repeating character print 0. For Example input : Hello result: H input : xxyyzz result: 0

26th Apr 2018, 10:42 AM
Ajith
Ajith - avatar
1 Respuesta
+ 1
char in, cmp{'\0'}; bool repeated{false}; while (std::cin >> in) { if (in == cmp) repeated = true; if (!repeated && in != cmp) { std::cout << in; break; } else { cmp = in; repeated = false; } }
26th Apr 2018, 11:02 AM
Timon Paßlick
En tendencia hoy
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
help
0 Votes
AI
2 Votes
APIs
1 Votes