/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
int getDecimalValue(ListNode* head) {
string s="";
while(head)
{
s+=(int)(head->val)+'0';
head=head->next;
}
cout<<s;
int res=0;
for(int i=0;i<s.size();i++)
{
res+=(s[i]-'0')*pow(2,s.size()-1-i);
}
return res;
}
};