Help me in solving BICEPS problem

My issue

Not able to clear third hidden case

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
    long a ;
    std::cin >> a;
    int l = 0;
    long c = a;
    long d = a;
    long sum = 0;
    while(a>0)
    { a = a/10;
    l++;
    }
    
    while(c>0)
    {
       int r = c%10 ;
       sum+= pow(r,l);
       c = c/10;
       
    }
    if ( sum == d)
    {
        std::cout << "yes" << std::endl;
    }
    else {
        std::cout << "no" << std::endl;
    }
    
    

}

Problem Link: Armstrong Numbers Practice Coding Problem