Online Compiler C

#include <stdio.h> int main() { int n, m = 0, a, b=0; scanf("%d", &n); while (n != 0) { a = n % 10; if (a == b) { m = 1; break; } b = a; n = n / 10; } if (m == 1) printf("YES"); else printf("NO"); return 0; }
This code reads an integer and checks if it has two identical adjacent digits. It processes the number from right to left, comparing each digit with the previous one. If a match is found, it prints YES; otherwise NO.

- The variable `b` is initialized to 0, which means the first digit will always be compared to 0. If the number ends with 0, this could incorrectly trigger a match. Consider what initial value for `b` would avoid this false comparison.
- The loop processes digits from the least significant to the most significant. Think about whether the order of digits matters for detecting adjacent duplicates, and if the current approach correctly handles all cases.