output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <iostream> using namespace std; string A,B,C; int main(){ cin >> A >> B >> C; cout << A[0] << B[0] << C[0] << endl; }
### Prompt Construct a Cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; string A,B,C; int main(){ cin >> A >> B >> C; cout << A[0] << B[0] << C[0] << endl; } ```
#include <iostream> using namespace std; int main() { string s1,s2,s3; cin>>s1>>s2>>s3; cout<<s1[0]<<s2[0]<<s3[0]; }
### Prompt Construct a Cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string s1,s2,s3; cin>>s1>>s2>>s3; cout<<s1[0]<<s2[0]<<s3[0]; } ```
#include <cstdio> int main() { char s[101]; scanf("%*s %s", s); printf("A%cC\n", *s); return 0; }
### Prompt Generate a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <cstdio> int main() { char s[101]; scanf("%*s %s", s); printf("A%cC\n", *s); return 0; } ```
#include<iostream> using namespace std; int main(){ string a,b,c; cin >> a >> b >> c; cout << a[0] << b[0] << c[0] << endl; }
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(){ string a,b,c; cin >> a >> b >> c; cout << a[0] << b[0] << c[0] << endl; } ```
#include<bits/stdc++.h> using namespace std; int main(){ string s,s1,s2; cin>>s1>>s>>s2; cout<<"A"<<s[0]<<"C"; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string s,s1,s2; cin>>s1>>s>>s2; cout<<"A"<<s[0]<<"C"; } ```
#include<bits/stdc++.h> using namespace std; string s,s1,s2; int main() { cin>>s>>s1>>s2; printf("%c%c%c\n",s[0],s1[0],s2[0]); }
### Prompt Please formulate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; string s,s1,s2; int main() { cin>>s>>s1>>s2; printf("%c%c%c\n",s[0],s1[0],s2[0]); } ```
#include <stdio.h> int main(void){ char sfirst; scanf("%*s %c",&sfirst); printf("A%cC",sfirst); return 0; };
### Prompt Please create a solution in cpp to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <stdio.h> int main(void){ char sfirst; scanf("%*s %c",&sfirst); printf("A%cC",sfirst); return 0; }; ```
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s;cin>>s; char A=s.at(0); cout<<"A"<<A<<"C"<<endl; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s;cin>>s; char A=s.at(0); cout<<"A"<<A<<"C"<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string s,A,C; cin>>A>>s>>C; cout<<"A"<<s.at(0)<<"C"<<endl; }
### Prompt Create a solution in Cpp for the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s,A,C; cin>>A>>s>>C; cout<<"A"<<s.at(0)<<"C"<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string s,t,u; cin >>s>>t>>u; cout << s[0]<<t[0]<<u[0]<<endl; }
### Prompt In cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s,t,u; cin >>s>>t>>u; cout << s[0]<<t[0]<<u[0]<<endl; } ```
#include <stdio.h> int main() { char s[100]; scanf("%s%s",s,s); printf("A%cC",s[0]); }
### Prompt Please formulate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <stdio.h> int main() { char s[100]; scanf("%s%s",s,s); printf("A%cC",s[0]); } ```
#include <iostream> using namespace std; int main(void){ string a,s,b; cin >> a >> s >> b; cout << "A"<<s[0]<<"C"<<endl; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main(void){ string a,s,b; cin >> a >> s >> b; cout << "A"<<s[0]<<"C"<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s >> s; cout << "A" << s.at(0) << "C"; }
### Prompt Develop a solution in CPP to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s >> s; cout << "A" << s.at(0) << "C"; } ```
#include <iostream> using namespace std; int main(void){ string f,s,e; cin >> f>>s>>e; cout<<f[0]<<s[0]<<e[0]; }
### Prompt Please provide a CPP coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main(void){ string f,s,e; cin >> f>>s>>e; cout<<f[0]<<s[0]<<e[0]; } ```
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S>>S; cout<<'A'<<S.at(0)<<'C'<<endl; }
### Prompt Construct a cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S>>S; cout<<'A'<<S.at(0)<<'C'<<endl; } ```
#include<cstdio> int main(){ char s[100]; scanf("AtCoder %s Contest",s); printf("A%cC",s[0]); }
### Prompt In CPP, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<cstdio> int main(){ char s[100]; scanf("AtCoder %s Contest",s); printf("A%cC",s[0]); } ```
#include<bits/stdc++.h> using namespace std; int main(){ string x,y,z; cin>>x>>y>>z; cout<<x[0]<<y[0]<<z[0]<<endl; }
### Prompt Construct a cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string x,y,z; cin>>x>>y>>z; cout<<x[0]<<y[0]<<z[0]<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string a; cin>>a>>a; cout<<"A"<<a.at(0)<<"C"<<endl; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string a; cin>>a>>a; cout<<"A"<<a.at(0)<<"C"<<endl; } ```
#include<stdio.h> int main(){ char a[100],b[1000],c[100]; scanf("%s %s %s",a,b,c); printf("A%cC",b[0]); return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<stdio.h> int main(){ char a[100],b[1000],c[100]; scanf("%s %s %s",a,b,c); printf("A%cC",b[0]); return 0; } ```
#include <bits/stdc++.h> using namespace std;int main() { string A, S, C; cin >> A >> S >> C; cout << "A" << S.at(0) << "C"; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std;int main() { string A, S, C; cin >> A >> S >> C; cout << "A" << S.at(0) << "C"; } ```
#include <iostream> using namespace std; int main() { string x; cin>>x; cin >>x; cout<<"A"<<x.at(0)<<"C"; }
### Prompt Your challenge is to write a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string x; cin>>x; cin >>x; cout<<"A"<<x.at(0)<<"C"; } ```
#include<bits/stdc++.h> using namespace std; int main(){ string a, b, c; cin >> a >> b >> c; cout << "A" << b.at(0) << "C"; }
### Prompt Please formulate a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string a, b, c; cin >> a >> b >> c; cout << "A" << b.at(0) << "C"; } ```
#include <cstdio> int main() { char s[105]; scanf("AtCoder %s Contest", &s[0]); printf("A%cC", s[0]); return 0; }
### Prompt Generate a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <cstdio> int main() { char s[105]; scanf("AtCoder %s Contest", &s[0]); printf("A%cC", s[0]); return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); cout << "A" << s[8] << "C"; }
### Prompt Generate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); cout << "A" << s[8] << "C"; } ```
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S >> S; cout << "A" << S.at(0) << "C"; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S >> S; cout << "A" << S.at(0) << "C"; } ```
#include <bits/stdc++.h> using namespace std; int main() { string x; getline (cin, x); cout << "A" << x.at(8) << "C"; }
### Prompt Please formulate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string x; getline (cin, x); cout << "A" << x.at(8) << "C"; } ```
#include <iostream> using namespace std; int main() { string s;cin>>s>>s; cout<<'A'<<s[0]<<'C'<<endl; return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string s;cin>>s>>s; cout<<'A'<<s[0]<<'C'<<endl; return 0; } ```
#include<iostream> using namespace std; int main(){ string a; while(cin>>a){ cout<<a[0]; } }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(){ string a; while(cin>>a){ cout<<a[0]; } } ```
#include <iostream> using namespace std; int main(){ string s1,s2,s3; cin>>s1>>s2>>s3; cout<<"A"<<s2.at(0)<<"C"<<endl; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main(){ string s1,s2,s3; cin>>s1>>s2>>s3; cout<<"A"<<s2.at(0)<<"C"<<endl; } ```
#include<bits/stdc++.h> using namespace std; signed main() { string a,b,c; cin>>a>>c>>b; cout<<a[0]<<c[0]<<b[0]<<"\n"; }
### Prompt In CPP, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; signed main() { string a,b,c; cin>>a>>c>>b; cout<<a[0]<<c[0]<<b[0]<<"\n"; } ```
#include<iostream> using namespace std; int main() { string a,b,c; cin>>a>>b>>c; return!(cout<<a[0]<<b[0]<<c[0]<<'\n'); }
### Prompt Create a solution in cpp for the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main() { string a,b,c; cin>>a>>b>>c; return!(cout<<a[0]<<b[0]<<c[0]<<'\n'); } ```
#include<bits/stdc++.h> using namespace std; int main(){ string a,b,c; cin>>a>>b>>c; cout<<a[0]<<b[0]<<c[0]<<endl; }
### Prompt Please provide a CPP coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string a,b,c; cin>>a>>b>>c; cout<<a[0]<<b[0]<<c[0]<<endl; } ```
#include<iostream> using namespace std; int main() { string a, b, c; cin >> a; cin >> b; cin >> c; cout<<a[0]<<b[0]<<c[0]; }
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main() { string a, b, c; cin >> a; cin >> b; cin >> c; cout<<a[0]<<b[0]<<c[0]; } ```
#include <iostream> using namespace std; int main() { string s; cin >> s >> s; cout << "A" << s[0] << "C" << endl; }
### Prompt Please create a solution in cpp to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string s; cin >> s >> s; cout << "A" << s[0] << "C" << endl; } ```
#include<bits/stdc++.h> using namespace std; int main(void){ string S; cin >> S >> S; cout << "A" << S[0] << "C" << endl; }
### Prompt Generate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(void){ string S; cin >> S >> S; cout << "A" << S[0] << "C" << endl; } ```
#include <iostream> #include <string> using namespace std; int main() { string s; getline(cin,s); cout<<"A"<<s[8]<<"C"; }
### Prompt In cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin,s); cout<<"A"<<s[8]<<"C"; } ```
#include<bits/stdc++.h> using namespace std; int main(){ for(int j=0;j<3;j++){string s;cin>>s;cout<<s[0];}cout<<endl; }
### Prompt Please provide a CPP coded solution to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ for(int j=0;j<3;j++){string s;cin>>s;cout<<s[0];}cout<<endl; } ```
#include<stdio.h> char str[101]; int main(void){ for(int i=1;i<=3;i++) scanf("%s",str),printf("%c",str[0]); return 0; }
### Prompt Your task is to create a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<stdio.h> char str[101]; int main(void){ for(int i=1;i<=3;i++) scanf("%s",str),printf("%c",str[0]); return 0; } ```
#include<iostream> using namespace std; int main(){ string s,t,u;cin >> s >> t >> u; cout << "A" << t[0] << "C" << endl; }
### Prompt In CPP, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(){ string s,t,u;cin >> s >> t >> u; cout << "A" << t[0] << "C" << endl; } ```
#include <bits/stdc++.h> using namespace std; int main(){ string a,s,b; cin>>a>>s>>b; cout<<'A'<<s.at(0)<<'C'<<endl; }
### Prompt Generate a cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ string a,s,b; cin>>a>>s>>b; cout<<'A'<<s.at(0)<<'C'<<endl; } ```
#include<cstdio> int main(){ char usisan[200]; scanf("AtCoder %s Contest",usisan); printf("A%cC\n",usisan[0]); }
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<cstdio> int main(){ char usisan[200]; scanf("AtCoder %s Contest",usisan); printf("A%cC\n",usisan[0]); } ```
#include<cstdio> char s[100]; int main(){ scanf("%s",s);scanf("%s",s); putchar('A');putchar(s[0]);puts("C"); }
### Prompt In Cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<cstdio> char s[100]; int main(){ scanf("%s",s);scanf("%s",s); putchar('A');putchar(s[0]);puts("C"); } ```
#include <bits/stdc++.h> using namespace std; int main() { string s,t; cin>>s>>t; cout<<"A"<<t.at(0)<<"C"<<endl; }
### Prompt Please formulate a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s,t; cin>>s>>t; cout<<"A"<<t.at(0)<<"C"<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string x; cin >> x >> x; cout << "A" << x[0] << "C" << endl; }
### Prompt Construct a Cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string x; cin >> x >> x; cout << "A" << x[0] << "C" << endl; } ```
#include <iostream> using namespace std; int main(void){ string A, B; cin>>A>>B; printf("A%cC\n", (B[0])); }
### Prompt Create a solution in CPP for the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main(void){ string A, B; cin>>A>>B; printf("A%cC\n", (B[0])); } ```
#include<iostream> using namespace std; string a,b,c; int main(){ cin>>a>>b>>c; cout<<a[0]<<b[0]<<c[0]<<"\n"; return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; string a,b,c; int main(){ cin>>a>>b>>c; cout<<a[0]<<b[0]<<c[0]<<"\n"; return 0; } ```
#include<iostream> using namespace std; int main(void){ char s[100]; cin>>s>>s; cout<<"A"<<s[0]<<"C"<<endl; }
### Prompt In CPP, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(void){ char s[100]; cin>>s>>s; cout<<"A"<<s[0]<<"C"<<endl; } ```
#include<iostream> using namespace std; int main(){ string s1,s2,s3; cin>>s1>>s2>>s3; cout<<"A"<<s2[0]<<"C";}
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(){ string s1,s2,s3; cin>>s1>>s2>>s3; cout<<"A"<<s2[0]<<"C";} ```
#include <bits/stdc++.h> using namespace std; int main() { string s,x; cin >> s >> x; cout << 'A' << x.at(0) << 'C' << endl; }
### Prompt Please formulate a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s,x; cin >> s >> x; cout << 'A' << x.at(0) << 'C' << endl; } ```
#include <iostream> using namespace std; int main() { string a,b,c; cin>>a>>b>>c; cout<<"A"<<b[0]<<"C"; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string a,b,c; cin>>a>>b>>c; cout<<"A"<<b[0]<<"C"; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { string a,x,c; cin >> a >> x >> c; cout << "A"<<x.at(0)<< "C"; }
### Prompt In cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string a,x,c; cin >> a >> x >> c; cout << "A"<<x.at(0)<< "C"; } ```
#include <bits/stdc++.h> using namespace std; int main() { string a,s,b; cin>>a>>s>>b; cout<<"A"<<s[0]<<"C"<<endl; }
### Prompt In Cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string a,s,b; cin>>a>>s>>b; cout<<"A"<<s[0]<<"C"<<endl; } ```
#include <iostream> using namespace std; int main() { string str; while(cin>>str){ cout<<str[0]; } }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <iostream> using namespace std; int main() { string str; while(cin>>str){ cout<<str[0]; } } ```
#include <bits/stdc++.h> using namespace std; int main() { char a; string b,c,d; cin>>b>>a>>c>>d; cout<<"A"<<a<<"C"; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { char a; string b,c,d; cin>>b>>a>>c>>d; cout<<"A"<<a<<"C"; } ```
#include <bits/stdc++.h> using namespace std; int main(){ string x,s,y; cin>>x>>s>>y; cout<<x[0]<<s[0]<<y[0]; }
### Prompt Construct a cpp code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ string x,s,y; cin>>x>>s>>y; cout<<x[0]<<s[0]<<y[0]; } ```
#include<stdio.h> #include<math.h> int main(){ char A[100],S[100]; scanf("%s %s",&A,&S); printf("A%cC\n",S[0]); return 0; }
### Prompt In cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<stdio.h> #include<math.h> int main(){ char A[100],S[100]; scanf("%s %s",&A,&S); printf("A%cC\n",S[0]); return 0; } ```
#include<stdio.h> int main() { char a[8],s[100],c[8]; scanf("%s%s%s",&a,&s,&c); printf("A%cC\n",s[0]); return 0; }
### Prompt Create a solution in Cpp for the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<stdio.h> int main() { char a[8],s[100],c[8]; scanf("%s%s%s",&a,&s,&c); printf("A%cC\n",s[0]); return 0; } ```
#include<iostream> using namespace std; int main(){ string x,y,z; cin>>x>>y>>z; cout<<x[0]<<y[0]<<z[0]; }
### Prompt Create a solution in CPP for the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include<iostream> using namespace std; int main(){ string x,y,z; cin>>x>>y>>z; cout<<x[0]<<y[0]<<z[0]; } ```
#include <bits/stdc++.h> using namespace std; int main() { string gomi,a; cin>>gomi>>a; cout<<"A"<<a.at(0)<<"C"<<endl; }
### Prompt Please create a solution in CPP to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string gomi,a; cin>>gomi>>a; cout<<"A"<<a.at(0)<<"C"<<endl; } ```
#include <stdio.h> char str[101]; int main() { scanf(" %s", str); scanf(" %s", str); printf("A%cC", str[0]); return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <stdio.h> char str[101]; int main() { scanf(" %s", str); scanf(" %s", str); printf("A%cC", str[0]); return 0; } ```
#include <stdio.h> int main (){ char a[118]; for(int i=0;i<118;i++){ scanf("%c",&a[i]); } printf("A%cC",a[8]); return 0; }
### Prompt Construct a CPP code solution to the problem outlined: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <stdio.h> int main (){ char a[118]; for(int i=0;i<118;i++){ scanf("%c",&a[i]); } printf("A%cC",a[8]); return 0; } ```
#include <stdio.h> int main() { char s[101], a[101], c[101]; scanf("%s %s %s", a, s, c); printf("A%cC\n", s[0]); }
### Prompt In Cpp, your task is to solve the following problem: Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. Constraints * The length of s is between 1 and 100, inclusive. * The first character in s is an uppercase English letter. * The second and subsequent characters in s are lowercase English letters. Input The input is given from Standard Input in the following format: AtCoder s Contest Output Print the abbreviation of the name of the contest. Examples Input AtCoder Beginner Contest Output ABC Input AtCoder Snuke Contest Output ASC Input AtCoder X Contest Output AXC ### Response ```cpp #include <stdio.h> int main() { char s[101], a[101], c[101]; scanf("%s %s %s", a, s, c); printf("A%cC\n", s[0]); } ```
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int len=s.length(); for(int i=0;i<len-1;i++){ if(s.at(i)==s.at(i+1)){ cout<<i+1<<" "<<i+2<<endl; return 0; } } for(int i=0;i<len-2;i++){ if(s.at(i)==s.at(i+2)){ cout<<i+1<<" "<<i+3<<endl; return 0; } } cout<<-1<<" "<<-1<<endl; return 0; }
### Prompt Your task is to create a CPP solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int len=s.length(); for(int i=0;i<len-1;i++){ if(s.at(i)==s.at(i+1)){ cout<<i+1<<" "<<i+2<<endl; return 0; } } for(int i=0;i<len-2;i++){ if(s.at(i)==s.at(i+2)){ cout<<i+1<<" "<<i+3<<endl; return 0; } } cout<<-1<<" "<<-1<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; const int N = 1e5+10; char s[N]; void solve() { scanf("%s", s); int l = strlen(s); for (int i = 0; i < l; i++) { if (i+1 < l && s[i] == s[i+1]) { printf("%d %d\n", i+1, i+2); return; } if (i+2 < l && s[i] == s[i+2]) { printf("%d %d\n", i+1, i+3); return; } } puts("-1 -1"); } int main() { solve(); return 0; }
### Prompt Construct a cpp code solution to the problem outlined: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const int N = 1e5+10; char s[N]; void solve() { scanf("%s", s); int l = strlen(s); for (int i = 0; i < l; i++) { if (i+1 < l && s[i] == s[i+1]) { printf("%d %d\n", i+1, i+2); return; } if (i+2 < l && s[i] == s[i+2]) { printf("%d %d\n", i+1, i+3); return; } } puts("-1 -1"); } int main() { solve(); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = 0;i < s.size();i++){ if(i == s.size()-1)cout << -1 << " " << -1 << endl; else if(s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; break; }else if(i < s.size()-1 && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; break; } } }
### Prompt Please create a solution in CPP to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = 0;i < s.size();i++){ if(i == s.size()-1)cout << -1 << " " << -1 << endl; else if(s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; break; }else if(i < s.size()-1 && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; break; } } } ```
#include<bits/stdc++.h> using namespace std; int main() { string S; cin >> S; for (int i = 0; i < S.size()-1; i++) { if (S[i] == S[i + 1]) { cout << i + 1 << " " << i + 2 << endl; return 0; } } for (int i = 0; i < S.size() - 2; i++) { if (S[i] == S[i + 2]) { cout << i + 1 << " " << i + 3 << endl; return 0; } } cout<<-1<<" "<<-1<<endl; }
### Prompt Generate a CPP solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { string S; cin >> S; for (int i = 0; i < S.size()-1; i++) { if (S[i] == S[i + 1]) { cout << i + 1 << " " << i + 2 << endl; return 0; } } for (int i = 0; i < S.size() - 2; i++) { if (S[i] == S[i + 2]) { cout << i + 1 << " " << i + 3 << endl; return 0; } } cout<<-1<<" "<<-1<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int st=-2,g=-2; for(int i=1;i<s.size();i++){ if(s[i]==s[i-1]){ st=i-1,g=i; } } for(int i=2;i<s.size();i++){ if(s[i]==s[i-2]){ st=i-2,g=i; } } cout<<st+1<<' '<<g+1<<endl; }
### Prompt Please create a solution in CPP to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int st=-2,g=-2; for(int i=1;i<s.size();i++){ if(s[i]==s[i-1]){ st=i-1,g=i; } } for(int i=2;i<s.size();i++){ if(s[i]==s[i-2]){ st=i-2,g=i; } } cout<<st+1<<' '<<g+1<<endl; } ```
#include <cstdio> #include <cstring> using namespace std; int main() { char s[131072]={}; scanf("%s", s); size_t ub=strlen(s); s[ub] = '$'; for (size_t i=0; i<ub; ++i) for (size_t j=1; j<=2; ++j) if (s[i] == s[i+j]) { printf("%llu %llu\n", i+1, i+j+1); return 0; } printf("-1 -1\n"); return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <cstdio> #include <cstring> using namespace std; int main() { char s[131072]={}; scanf("%s", s); size_t ub=strlen(s); s[ub] = '$'; for (size_t i=0; i<ub; ++i) for (size_t j=1; j<=2; ++j) if (s[i] == s[i+j]) { printf("%llu %llu\n", i+1, i+j+1); return 0; } printf("-1 -1\n"); return 0; } ```
#include<cstdio> #include<cstring> using namespace std; #define MAXN 1000005 char s[MAXN]; int main() { scanf("%s",s); int len=strlen(s); for(int i=0;i<len-1;i++) { if(s[i]==s[i+1]) { printf("%d %d\n",i+1,i+2); return 0; } if(s[i]==s[i+2]) { printf("%d %d\n",i+1,i+3); return 0; } } printf("-1 -1\n"); return 0; }
### Prompt Develop a solution in CPP to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<cstdio> #include<cstring> using namespace std; #define MAXN 1000005 char s[MAXN]; int main() { scanf("%s",s); int len=strlen(s); for(int i=0;i<len-1;i++) { if(s[i]==s[i+1]) { printf("%d %d\n",i+1,i+2); return 0; } if(s[i]==s[i+2]) { printf("%d %d\n",i+1,i+3); return 0; } } printf("-1 -1\n"); return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int a = -1,b = -1; char s[1000004]; scanf("%s",s); for(int i = 0; i < strlen(s); i++){ if(s[i] == s[i+1] ){ a = i + 1 ; b = i + 2; break; } if(s[i] == s[i+2]){ a = i + 1; b = i + 3; break ; } } cout << a << " " << b << "\n"; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int a = -1,b = -1; char s[1000004]; scanf("%s",s); for(int i = 0; i < strlen(s); i++){ if(s[i] == s[i+1] ){ a = i + 1 ; b = i + 2; break; } if(s[i] == s[i+2]){ a = i + 1; b = i + 3; break ; } } cout << a << " " << b << "\n"; return 0; } ```
#include<bits/stdc++.h> using namespace std; const int N=100005; char s[N]; int main(){ scanf("%s",s+1); int n=strlen(s+1); for (int i=1;i<=n;i++){ if (s[i]==s[i+1]){ printf("%d %d\n",i,i+1); return 0; } if (s[i]==s[i+2]){ printf("%d %d\n",i,i+2); return 0; } } puts("-1 -1"); }
### Prompt Create a solution in cpp for the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; const int N=100005; char s[N]; int main(){ scanf("%s",s+1); int n=strlen(s+1); for (int i=1;i<=n;i++){ if (s[i]==s[i+1]){ printf("%d %d\n",i,i+1); return 0; } if (s[i]==s[i+2]){ printf("%d %d\n",i,i+2); return 0; } } puts("-1 -1"); } ```
#include<iostream> #include<algorithm> #include<cmath> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> using namespace std; string s;int len; int main() { cin>>s;len=s.size(); for(int i=0;i<len-1;i++) if(s[i]==s[i+1]){printf("%d %d\n",i+1,i+2);return 0;} for(int i=0;i<len-2;i++) if(s[i]==s[i+2]){printf("%d %d\n",i+1,i+3);return 0;} printf("-1 -1\n"); return 0; }
### Prompt Develop a solution in cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<iostream> #include<algorithm> #include<cmath> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> using namespace std; string s;int len; int main() { cin>>s;len=s.size(); for(int i=0;i<len-1;i++) if(s[i]==s[i+1]){printf("%d %d\n",i+1,i+2);return 0;} for(int i=0;i<len-2;i++) if(s[i]==s[i+2]){printf("%d %d\n",i+1,i+3);return 0;} printf("-1 -1\n"); return 0; } ```
#include<cstdio> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<algorithm> using namespace std; const int MAXN=100005; char s[MAXN]; int main() { scanf("%s",s); int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]==s[i+1]) { printf("%d %d\n",i+1,i+2); return 0; } if(s[i]==s[i+2]) { printf("%d %d\n",i+1,i+3); return 0; } } printf("-1 -1\n"); }
### Prompt Please formulate a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<cstdio> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<algorithm> using namespace std; const int MAXN=100005; char s[MAXN]; int main() { scanf("%s",s); int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]==s[i+1]) { printf("%d %d\n",i+1,i+2); return 0; } if(s[i]==s[i+2]) { printf("%d %d\n",i+1,i+3); return 0; } } printf("-1 -1\n"); } ```
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ string S; cin >> S; for(int i=0; i<S.size()-1; i++){ if(S[i] == S[i+1]){ cout << i+1 << " " << i+2 << endl; return 0; } } for(int i=0; i<S.size()-2; i++){ if(S[i] == S[i+2]){ cout << i+1 << " " << i+3 << endl; return 0; } } cout << -1 << " " << -1 << endl; return 0; }
### Prompt Please create a solution in cpp to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ string S; cin >> S; for(int i=0; i<S.size()-1; i++){ if(S[i] == S[i+1]){ cout << i+1 << " " << i+2 << endl; return 0; } } for(int i=0; i<S.size()-2; i++){ if(S[i] == S[i+2]){ cout << i+1 << " " << i+3 << endl; return 0; } } cout << -1 << " " << -1 << endl; return 0; } ```
#include <cstdio> #include <iostream> using namespace std; int main(){ string a; cin >> a; for(int i=0;i+1<a.length();++i){ if(a[i]==a[i+1]){ cout << i+1 << " " << i+2 ; return 0; } if(i+2<a.length() && a[i]==a[i+2]){ cout << i+1 << " " << i+3 ; return 0; } } cout << "-1 -1" ; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <cstdio> #include <iostream> using namespace std; int main(){ string a; cin >> a; for(int i=0;i+1<a.length();++i){ if(a[i]==a[i+1]){ cout << i+1 << " " << i+2 ; return 0; } if(i+2<a.length() && a[i]==a[i+2]){ cout << i+1 << " " << i+3 ; return 0; } } cout << "-1 -1" ; return 0; } ```
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MAXN 100000 char s[MAXN+5]; int a[30]; int main() { scanf("%s",s+1); int len=strlen(s+1); if(len<2) { puts("-1 -1"); return 0; } for(int i=2;i<=len;i++) { if(s[i]==s[i-1]||s[i]==s[i-2]||s[i-1]==s[i-2]) { if(i==2) printf("1 2\n"); else printf("%d %d",i-2,i); return 0; } } puts("-1 -1"); }
### Prompt Create a solution in Cpp for the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MAXN 100000 char s[MAXN+5]; int a[30]; int main() { scanf("%s",s+1); int len=strlen(s+1); if(len<2) { puts("-1 -1"); return 0; } for(int i=2;i<=len;i++) { if(s[i]==s[i-1]||s[i]==s[i-2]||s[i-1]==s[i-2]) { if(i==2) printf("1 2\n"); else printf("%d %d",i-2,i); return 0; } } puts("-1 -1"); } ```
#include<stdio.h> #include<algorithm> #include<string.h> using namespace std; char str[210000]; int main(){ scanf("%s",str); int n=strlen(str); for(int i=0;i<n-1;i++)if(str[i]==str[i+1]){ printf("%d %d\n",i+1,i+2);return 0; } for(int i=0;i<n-2;i++)if(str[i]==str[i+2]){ printf("%d %d\n",i+1,i+3);return 0; } printf("-1 -1\n"); }
### Prompt Your task is to create a CPP solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; char str[210000]; int main(){ scanf("%s",str); int n=strlen(str); for(int i=0;i<n-1;i++)if(str[i]==str[i+1]){ printf("%d %d\n",i+1,i+2);return 0; } for(int i=0;i<n-2;i++)if(str[i]==str[i+2]){ printf("%d %d\n",i+1,i+3);return 0; } printf("-1 -1\n"); } ```
#include <iostream> using namespace std; int main(void){ int len; string s; cin >> s; len = s.length(); for(int i=0;i<len-1;i++){ if(s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; return 0; } if(i+2 < len && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; return 0; } } puts("-1 -1"); }
### Prompt In cpp, your task is to solve the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> using namespace std; int main(void){ int len; string s; cin >> s; len = s.length(); for(int i=0;i<len-1;i++){ if(s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; return 0; } if(i+2 < len && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; return 0; } } puts("-1 -1"); } ```
#include <bits/stdc++.h> using namespace std; int main() { char a[100011]; int n,i,j; scanf("%s",a); for(i=0;i<strlen(a)-1;i++) { if(a[i]==a[i+1]) { cout<<i+1<<" "<<i+2<<"\n"; return 0; } } for(i=0;i<strlen(a)-2;i++) { if(a[i]==a[i+2]) { cout<<i+1<<" "<<i+3<<"\n"; return 0; } } cout<<"-1 -1\n"; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { char a[100011]; int n,i,j; scanf("%s",a); for(i=0;i<strlen(a)-1;i++) { if(a[i]==a[i+1]) { cout<<i+1<<" "<<i+2<<"\n"; return 0; } } for(i=0;i<strlen(a)-2;i++) { if(a[i]==a[i+2]) { cout<<i+1<<" "<<i+3<<"\n"; return 0; } } cout<<"-1 -1\n"; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; if(s.length()==2) { if(s[0]==s[1]) { cout<<"1 2\n"; } else { cout<<"-1 -1\n"; } return 0; } for(int i=0;i<=s.length()-3;i++) { string p= s.substr(i,3); if(p[0]==p[1] or p[0]==p[2] or p[1]==p[2]) { cout<<i+1<<" "<<i+3<<"\n"; return 0; } } cout<<"-1 -1\n"; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; if(s.length()==2) { if(s[0]==s[1]) { cout<<"1 2\n"; } else { cout<<"-1 -1\n"; } return 0; } for(int i=0;i<=s.length()-3;i++) { string p= s.substr(i,3); if(p[0]==p[1] or p[0]==p[2] or p[1]==p[2]) { cout<<i+1<<" "<<i+3<<"\n"; return 0; } } cout<<"-1 -1\n"; return 0; } ```
#include <bits/stdc++.h> using namespace std; const int Max=100005; int n; char ch[Max]; int main() { scanf("%s",ch+1),n=strlen(ch+1); for(int i=1;i<=n;i++) { if(ch[i]==ch[i+1]) {cout<<i<<" "<<i+1<<"\n";return 0;} if(ch[i]==ch[i+2]) {cout<<i<<" "<<i+2<<"\n";return 0;} } cout<<"-1 -1\n"; return 0; }
### Prompt Generate a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const int Max=100005; int n; char ch[Max]; int main() { scanf("%s",ch+1),n=strlen(ch+1); for(int i=1;i<=n;i++) { if(ch[i]==ch[i+1]) {cout<<i<<" "<<i+1<<"\n";return 0;} if(ch[i]==ch[i+2]) {cout<<i<<" "<<i+2<<"\n";return 0;} } cout<<"-1 -1\n"; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; for( size_t i = 0; i < S.size() - 1; i++ ) { if( S[i] == S[i + 1] ) { cout << i + 1 << " " << i + 2 << endl; return 0; } } for( size_t i = 0; i < S.size() - 2; i++ ) { if( S[i] == S[i + 2] ) { cout << i + 1 << " " << i + 3 << endl; return 0; } } cout << -1 << " " << -1 << endl; }
### Prompt Please create a solution in CPP to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; for( size_t i = 0; i < S.size() - 1; i++ ) { if( S[i] == S[i + 1] ) { cout << i + 1 << " " << i + 2 << endl; return 0; } } for( size_t i = 0; i < S.size() - 2; i++ ) { if( S[i] == S[i + 2] ) { cout << i + 1 << " " << i + 3 << endl; return 0; } } cout << -1 << " " << -1 << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = 0; i + 1 < s.size(); i++) if (s[i] == s[i + 1]) return cout << i + 1 << ' ' << i + 2, 0; for (int i = 0; i + 2 < s.size(); i++) if (s[i] == s[i + 2]) return cout << i + 1 << ' ' << i + 3, 0; cout << "-1 -1"; }
### Prompt Develop a solution in Cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = 0; i + 1 < s.size(); i++) if (s[i] == s[i + 1]) return cout << i + 1 << ' ' << i + 2, 0; for (int i = 0; i + 2 < s.size(); i++) if (s[i] == s[i + 2]) return cout << i + 1 << ' ' << i + 3, 0; cout << "-1 -1"; } ```
#include<bits/stdc++.h> using namespace std; string s; int l = -1,r = -1; int main() { cin >> s; int len = s.size(); for(int i = 0;i < len-1;i++) { if(s[i] == s[i+1]) { l = i+1; r = i+2; } } for(int i = 0;i < len-2;i++) { if(s[i] == s[i+2]) { l = i+1; r = i+3; } } cout << l << " " << r << endl; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; string s; int l = -1,r = -1; int main() { cin >> s; int len = s.size(); for(int i = 0;i < len-1;i++) { if(s[i] == s[i+1]) { l = i+1; r = i+2; } } for(int i = 0;i < len-2;i++) { if(s[i] == s[i+2]) { l = i+1; r = i+3; } } cout << l << " " << r << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = s.size()-1; i >= 2; i--){ if(s[i] == s[i-1] || s[i] == s[i-2]){ printf("%d %d\n", i-1, i+1); return 0; } } printf("%s\n", s[0] == s[1] ? "1 2" : "-1 -1"); }
### Prompt Generate a cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = s.size()-1; i >= 2; i--){ if(s[i] == s[i-1] || s[i] == s[i-2]){ printf("%d %d\n", i-1, i+1); return 0; } } printf("%s\n", s[0] == s[1] ? "1 2" : "-1 -1"); } ```
#include <iostream> using namespace std; int main(int argc, char** argv) { string s; cin >> s; for (int i = 1; i < s.size(); i++) if (s[i-1] == s[i]) { cout << i << ' ' << i+1 << endl; return 0; } for (int i = 2; i < s.size(); i++) if (s[i-2] == s[i]) { cout << i-1 << ' ' << i+1 << endl; return 0; } cout << "-1 -1\n"; }
### Prompt Generate a CPP solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> using namespace std; int main(int argc, char** argv) { string s; cin >> s; for (int i = 1; i < s.size(); i++) if (s[i-1] == s[i]) { cout << i << ' ' << i+1 << endl; return 0; } for (int i = 2; i < s.size(); i++) if (s[i-2] == s[i]) { cout << i-1 << ' ' << i+1 << endl; return 0; } cout << "-1 -1\n"; } ```
#include <iostream> #include <string> using namespace std; string s; int main(void) { cin >> s; if(s.size() == 2){ if(s[0] == s[1]){ cout << 1 << " " << 2 << endl; return 0; } } for(int i = 0; i < s.size()-2; i++){ if(s[i] == s[i+1] || s[i+1] == s[i+2] || s[i+2] == s[i]){ cout << i+1 << " " << i+3 << endl; return 0; } } cout << -1 << " " << -1 << endl; return 0; }
### Prompt Please formulate a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> #include <string> using namespace std; string s; int main(void) { cin >> s; if(s.size() == 2){ if(s[0] == s[1]){ cout << 1 << " " << 2 << endl; return 0; } } for(int i = 0; i < s.size()-2; i++){ if(s[i] == s[i+1] || s[i+1] == s[i+2] || s[i+2] == s[i]){ cout << i+1 << " " << i+3 << endl; return 0; } } cout << -1 << " " << -1 << endl; return 0; } ```
#include <stdio.h> char s[100005]; int main(){ scanf("%s", s); if(s[0] == s[1]){ printf("1 2"); return 0; } for(int i=0; s[i+2]; i++){ if(s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2]){ printf("%d %d", i+1, i+3); return 0; } } printf("-1 -1"); return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <stdio.h> char s[100005]; int main(){ scanf("%s", s); if(s[0] == s[1]){ printf("1 2"); return 0; } for(int i=0; s[i+2]; i++){ if(s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2]){ printf("%d %d", i+1, i+3); return 0; } } printf("-1 -1"); return 0; } ```
#include<iostream> #include<string> using namespace std; int main() { string S; cin>>S; int s = -1, t = -1; if(S.size()==2){ if(S[0]==S[1]){ s = 1; t = 2; } } else { for(int i=0;i<S.size()-3;++i){ if((S[i] == S[i+1]) | (S[i] == S[i+2]) | (S[i+1] == S[i+2])){ s = i+1; t = i+3; } } } cout<<s<<" "<<t<<endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<iostream> #include<string> using namespace std; int main() { string S; cin>>S; int s = -1, t = -1; if(S.size()==2){ if(S[0]==S[1]){ s = 1; t = 2; } } else { for(int i=0;i<S.size()-3;++i){ if((S[i] == S[i+1]) | (S[i] == S[i+2]) | (S[i+1] == S[i+2])){ s = i+1; t = i+3; } } } cout<<s<<" "<<t<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; for (int i = 0; i < str.length(); ++i) { if (i + 1 < str.length() && str[i] == str[i + 1]) { cout << i + 1 << " " << i + 2; return 0; } if (i + 2 < str.length() && str[i] == str[i + 2]) { cout << i + 1 << " " << i + 3; return 0; } } cout << "-1 -1"; return 0; }
### Prompt Create a solution in CPP for the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; for (int i = 0; i < str.length(); ++i) { if (i + 1 < str.length() && str[i] == str[i + 1]) { cout << i + 1 << " " << i + 2; return 0; } if (i + 2 < str.length() && str[i] == str[i + 2]) { cout << i + 1 << " " << i + 3; return 0; } } cout << "-1 -1"; return 0; } ```
#include <iostream> using namespace std; int a=-1,b,i; int main(){ string s; cin>>s; for(i=0;i<s.length()-1;i++)if(s[i]==s[i+1])a=i+1,b=i+2; for(i=0;i<s.length()-2;i++)if(s[i]==s[i+2])a=i+1,b=i+3; if(a!=-1)cout<<a<<" "<<b; else cout<<-1<<" "<<-1; }
### Prompt Please create a solution in Cpp to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> using namespace std; int a=-1,b,i; int main(){ string s; cin>>s; for(i=0;i<s.length()-1;i++)if(s[i]==s[i+1])a=i+1,b=i+2; for(i=0;i<s.length()-2;i++)if(s[i]==s[i+2])a=i+1,b=i+3; if(a!=-1)cout<<a<<" "<<b; else cout<<-1<<" "<<-1; } ```
#include <bits/stdc++.h> using namespace std; int n,pd; char s[100010],ji[5]; int main() { scanf("%s",s+1); n=strlen(s+1); ji[2]=s[1]; for(int i=2;i<=n;++i) { if(s[i]==ji[2]) { pd=1; printf("%d %d\n",i-1,i); break; } if(s[i]==ji[1]) { pd=1; printf("%d %d\n",i-2,i); break; } ji[1]=ji[2]; ji[2]=s[i]; } if(pd==0) printf("-1 -1\n"); return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,pd; char s[100010],ji[5]; int main() { scanf("%s",s+1); n=strlen(s+1); ji[2]=s[1]; for(int i=2;i<=n;++i) { if(s[i]==ji[2]) { pd=1; printf("%d %d\n",i-1,i); break; } if(s[i]==ji[1]) { pd=1; printf("%d %d\n",i-2,i); break; } ji[1]=ji[2]; ji[2]=s[i]; } if(pd==0) printf("-1 -1\n"); return 0; } ```
#include <bits/stdc++.h> using namespace std; #define N 100005 char s[N]; int main() { scanf("%s", s); int n = strlen(s); for (int i = 0; i < n; i ++) { if (i + 1 < n && s[i] == s[i+1]) { printf("%d %d\n", i+1, i+2); return 0; } if (i + 2 < n && s[i] == s[i+2]) { printf("%d %d\n", i+1, i+3); return 0; } } puts("-1 -1"); return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; #define N 100005 char s[N]; int main() { scanf("%s", s); int n = strlen(s); for (int i = 0; i < n; i ++) { if (i + 1 < n && s[i] == s[i+1]) { printf("%d %d\n", i+1, i+2); return 0; } if (i + 2 < n && s[i] == s[i+2]) { printf("%d %d\n", i+1, i+3); return 0; } } puts("-1 -1"); return 0; } ```
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll=long long; int main(){ string s; cin>>s; int a=-1,b=-1,n=s.size(); rep(i,n-1){ if(s[i]==s[i+1])a=i+1,b=i+2; } rep(i,n-2){ if(s[i]==s[i+2])a=i+1,b=i+3; } cout<<a<<" "<<b<<endl; return 0; }
### Prompt In CPP, your task is to solve the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll=long long; int main(){ string s; cin>>s; int a=-1,b=-1,n=s.size(); rep(i,n-1){ if(s[i]==s[i+1])a=i+1,b=i+2; } rep(i,n-2){ if(s[i]==s[i+2])a=i+1,b=i+3; } cout<<a<<" "<<b<<endl; return 0; } ```
#include <cstdio> #include <cstring> char str[100005]; int main() { scanf("%s", str); int len = strlen(str); int s = -1, e = -1; for (int i = 0; i < len; ++i) { if (str[i] == str[i + 1]) { s = i + 1; e = s + 1; } else if (str[i] == str[i + 2]) { s = i + 1; e = s + 2; } if (s > 0) break; } printf("%d %d", s, e); }
### Prompt Develop a solution in Cpp to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <cstdio> #include <cstring> char str[100005]; int main() { scanf("%s", str); int len = strlen(str); int s = -1, e = -1; for (int i = 0; i < len; ++i) { if (str[i] == str[i + 1]) { s = i + 1; e = s + 1; } else if (str[i] == str[i + 2]) { s = i + 1; e = s + 2; } if (s > 0) break; } printf("%d %d", s, e); } ```
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; ll n = s.size(); for (ll i = 0; i < n - 2; i++) { if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) { cout << i + 1 << " " << i + 3 << endl; return 0; } } if (n == 2 && s[0] == s[1]) { cout << "1 2" << endl; } else { cout << "-1 -1" << endl; } }
### Prompt Your challenge is to write a cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; ll n = s.size(); for (ll i = 0; i < n - 2; i++) { if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) { cout << i + 1 << " " << i + 3 << endl; return 0; } } if (n == 2 && s[0] == s[1]) { cout << "1 2" << endl; } else { cout << "-1 -1" << endl; } } ```
#include <iostream> using namespace std; int main() { string s; cin>>s; int l = s.length(); int a = -1; int b = -1; for(int i=0;i<=l-1;i++) { if(s[i] == s[i+1]) { a = i + 1; b = i + 2; } } for(int i=0;i<=l-2;i++) { if(s[i] == s[i+2]) { a = i + 1; b = i + 3; } } cout<<a<<" "<<b<<endl; return 0; }
### Prompt Your task is to create a cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> using namespace std; int main() { string s; cin>>s; int l = s.length(); int a = -1; int b = -1; for(int i=0;i<=l-1;i++) { if(s[i] == s[i+1]) { a = i + 1; b = i + 2; } } for(int i=0;i<=l-2;i++) { if(s[i] == s[i+2]) { a = i + 1; b = i + 3; } } cout<<a<<" "<<b<<endl; return 0; } ```
#include <iostream> #include <string> using namespace std; int main() { string s; cin>>s; if(s[0]==s[1]){ cout<<1<<" "<<2<<endl; return 0; } for(int i=2;i<s.length();i++){ if(s[i]==s[i-2]||s[i]==s[i-1]){ cout<<i-1<<" "<<i+1<<endl; return 0; } } cout<<-1<<" "<<-1<<endl; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include <iostream> #include <string> using namespace std; int main() { string s; cin>>s; if(s[0]==s[1]){ cout<<1<<" "<<2<<endl; return 0; } for(int i=2;i<s.length();i++){ if(s[i]==s[i-2]||s[i]==s[i-1]){ cout<<i-1<<" "<<i+1<<endl; return 0; } } cout<<-1<<" "<<-1<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ string S;cin>>S; int n=S.size(); if(n==2){ if(S[0]==S[1])cout<<"1 2"<<endl; else cout<<"-1 -1"<<endl; return 0; } for(int i=0;i<n-2;i++){ if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+1]==S[i+2]){ cout<<i+1<<" "<<i+3<<endl; return 0; } } cout<<"-1 -1"<<endl; return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ string S;cin>>S; int n=S.size(); if(n==2){ if(S[0]==S[1])cout<<"1 2"<<endl; else cout<<"-1 -1"<<endl; return 0; } for(int i=0;i<n-2;i++){ if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+1]==S[i+2]){ cout<<i+1<<" "<<i+3<<endl; return 0; } } cout<<"-1 -1"<<endl; return 0; } ```
#include<cstdio> char c1,c2,c; int l=0; int main() { while(~scanf("%c",&c)) { l++; if(c1==c) { printf("%d %d",l-1,l); return 0; } if(c2==c) { printf("%d %d",l-2,l); return 0; } c2=c1; c1=c; } puts("-1 -1"); return 0; }
### Prompt Construct a cpp code solution to the problem outlined: Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s. Constraints * 2 ≦ |s| ≦ 10^5 * s consists of lowercase letters. Input The input is given from Standard Input in the following format: s Output If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. Examples Input needed Output 2 5 Input atcoder Output -1 -1 ### Response ```cpp #include<cstdio> char c1,c2,c; int l=0; int main() { while(~scanf("%c",&c)) { l++; if(c1==c) { printf("%d %d",l-1,l); return 0; } if(c2==c) { printf("%d %d",l-2,l); return 0; } c2=c1; c1=c; } puts("-1 -1"); return 0; } ```