diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-03 17:18:36 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-03 17:18:36 +0200 |
| commit | 0cef0cea2289b14264c5bf1693966c3c8cc0ca00 (patch) | |
| tree | c60b7a92bc9265d45b72886a073831ceb2f35cc3 | |
| parent | 6649a25ac7e680f799550c9dc7cef251c1595b63 (diff) | |
| download | competitive-programming-0cef0cea2289b14264c5bf1693966c3c8cc0ca00.tar.xz competitive-programming-0cef0cea2289b14264c5bf1693966c3c8cc0ca00.zip | |
Solved Infinite Replacement codeforeces
| -rw-r--r-- | InfiniteReplacement.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/InfiniteReplacement.cpp b/InfiniteReplacement.cpp new file mode 100644 index 0000000..850e0ec --- /dev/null +++ b/InfiniteReplacement.cpp @@ -0,0 +1,26 @@ +#include <algorithm> +#include<bits/stdc++.h> + +using namespace std; + +int main() { + int tt; + cin >> tt; + string s, t; + while (tt--) { + cin >> s; + cin >> t; + if(t.find('a') != std::string::npos && t.length() > 1) { + cout << "-1" << endl; + } + else if(t.find('a') != std::string::npos && t.length() == 1) { + cout << "1" << endl; + } + else { + long long ans = pow(2, s.length()); + cout << ans << endl; + } + } + + return 0; +} |
