Advertisement
gabrielcabezas

Untitled

Mar 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int N=1000005,crivo[1000005];
  4. int main()
  5. {
  6. string s1,s2;
  7. int a=0,c=0;
  8. double ans;
  9. cin >> s1;
  10. cin >> s2;
  11. for (int i=0;i<s1.size();i++)
  12. {
  13. if (s1[i]=='+')
  14. a++;
  15. else if (s1[i]=='-')
  16. a--;
  17. else if (s1[i]=='?')
  18. c++;
  19. }
  20. for (int i=0;i<s2.size();i++)
  21. {
  22. if (s2[i]=='+')
  23. a--;
  24. else if (s2[i]=='-')
  25. a++;
  26. else if (s2[i]=='?')
  27. c++;
  28. }
  29. if (c==0)
  30. {
  31. if (a==0)
  32. {
  33. ans=1;
  34. }
  35. else
  36. {
  37. ans=0;
  38. }
  39. printf("%lf",ans);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement