Official
A - TLD Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
Recheck how to handle strings (or arrays corresponding to them) before implementing.
This problem can be solved by the following two steps.
- Find the last occurrence of
.
in the given string. - Print the substring coming after that
.
.
Both of them can be realized with a for loop and some variables.
The implementation is even simplified if you know how to obtain the length of a string.
Sample code (C++):
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int l=s.size(),ldot=0;
for(int i=0;i<l;i++){
if(s[i]=='.'){ldot=i;}
}
for(int i=ldot+1;i<l;i++){
cout << s[i];
}
cout << "\n";
return 0;
}
posted:
last update: