fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void prefixHash(string s)
  5. {
  6. int sum=0;
  7. for(int i=0; i<s.size(); i++)
  8. {
  9. sum*=10;
  10. sum+=(s[i]-'0');
  11. }
  12. cout<<sum<<endl;
  13.  
  14. }
  15. int main()
  16. {
  17. string s="101245";
  18. int l=2,r=3;
  19. //calcHash(l,r,s);
  20. prefixHash(s);
  21. }
  22.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
101245