What's wrong with the C code?
Original question: https://www.sololearn.com/coach/54?ref=app Basically, I'm trying to find how many times a character occurs in a string. So my approach was to, loop through the string, set 'i' to the variable 'ch', then loop through the string again (nest loop), comparing if 'ch' is == 'i', and if it is, increment 'count' varible, otherwise do nothing. Then after everything is done, check if 'count' variable > 1, if it is, output "Deja Vu", else "Output". But my code isn't working well because it outputs "Deja Vu" on every test case. Hope y'all understand what exactly am trying to say 😔. My C CODE: #include <stdio.h> #include <string.h> int main() { char str[1000]; scanf("%s", str); int i, j, count = 0; char ch; for (i = 0; i < strlen(str); i++) { ch = i; for (j = 0; j < strlen(str); j++) { if (ch == j) { count++; } } } if (count > 1) { printf("Deja Vu"); } else { printf("Unique"); } return 0; }