From c52b36c6a37fdb1d1de146d3939cb42e2c691f44 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Sat, 5 Nov 2022 01:28:02 +0200 Subject: Solved 6 problem in filtrationContest and restructured the repo --- .../InfiniteReplacement/InfiniteReplacement.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 codeforces/InfiniteReplacement/InfiniteReplacement.cpp (limited to 'codeforces/InfiniteReplacement') diff --git a/codeforces/InfiniteReplacement/InfiniteReplacement.cpp b/codeforces/InfiniteReplacement/InfiniteReplacement.cpp new file mode 100644 index 0000000..850e0ec --- /dev/null +++ b/codeforces/InfiniteReplacement/InfiniteReplacement.cpp @@ -0,0 +1,26 @@ +#include +#include + +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; +} -- cgit v1.2.3