while(x) { rd[u++] = x % 10; x /= 10; }
int x = 0; for(int i=0; i<str.size(); i++) x = x * 10 + str[i] - '0';