def foblq(n):#菲薄列切数列f(n) = f(n-1)+f(n-2)
if(n <= 2):
return 1
a = 1
b = 1
for i in range(2,n):
s = a + b
a = b
b = s
return s
while True:
try:
n = int(input())
print(foblq(n))
except:
break
while True:
try:
s = input()
num_c = 0
str_c =0
k_c = 0
other_c = 0
for c in s:
if c.isdigit():
num_c += 1
elif c.isalpha():
str_c += 1
elif c == ' ':
k_c += 1
else:
other_c += 1
print(str_c)
print(k_c)
print(num_c)
print(other_c)
except:
break
#include<iostream>
using namespace std;
struct ListNode
{
int m_nKey;
ListNode* m_pNext;
ListNode():m_nKey(0),m_pNext(nullptr){};
ListNode(int(x)):m_nKey(x),m_pNext(nullptr){};
};
class Solution{
public:
ListNode* Knode(int n,ListNode* List,int k){//返回倒数第k个节点
if(List == NULL){
return nullptr;
}
int a = n-k+1;
while(a--){
List = List->m_pNext;
}
return List;
}
};
int main(){
int n,k,node;
Solution s;
while(cin >> n){//输入链表个数
ListNode *head = new ListNode();
ListNode *phead = head;
int num = n;
while(n--){//构造链表
cin >> node;//输出链表的节点
ListNode *next = new ListNode(node);
head = head -> m_pNext = next;
//head = next;
}
cin >> k;//倒数第k个节点
ListNode * res = s.Knode(num,phead,k);
if(res){
cout << res->m_nKey << endl;
}else{
cout << 0 <<endl;
}
}
return 0;
}
while True:
try:
n = int(input())
if(n < 3):
print(-1)
elif(n % 4 == 0):
print(3)
elif(n % 4 == 1 or n % 4 == 3):
print(2)
elif(n % 4 == 2):
print(4)
except:
break
#include<iostream>
using namespace std;
#include<string>
int main(){
string s;
int n;
while(cin >> s){
cin >> n;
// for(int i = 0; i < n;i++){
// cout << s[i];
// }
cout << s.substr(0,n)<<endl;
}
return 0;
}
while True:
try:
s = input()
n = int(input())
print(s[:n])
except:
break
#include<iostream>
using namespace std;
int main(){
int a[] = {31,28,31,30,31,30,31,31,30,31,30,31};//平年每一个月的天数,闰年第二个月29天
int year = 0, month = 0,day = 0;
while(cin >> year >> month >> day){
int sum = 0;
for(int i = 0; i < month;i++){
sum += a[i-1];//最后一个月不加,后面直接加day
}
if((year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) && month > 2){//闰年
sum += 1;
sum += day;
}else{
sum += day;
}
cout << sum << endl;
}
return 0;
}
while True:
try:
date = input().split()
year,month,day = int(date[0]),int(date[1]),int(date[2])
a = [31,28,31,30,31,30,31,31,30,31,30,31]
sum = 0
for i in range(month-1):
sum += a[i]
if (year % 400 == 0 or (year %4 == 0 and year % 100 !=0)) and month > 2:
sum += day
sum += 1
else:
sum += day
print(sum)
except:
break
while True:
try:
short_s = input()
long_s = input()
for i in short_s:
if i not in long_s:
print("false")
break
else:
print("true")
except:
break
while True:
try:
short_s = input()
long_s = input()
if set(short_s) & set(long_s) == set(short_s):
print("true")
else:
print("false")
except:
break
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main(){
string s1;
string s2;
while(cin >> s1 >> s2){
set<char>set2;
for(char c:s2){
set2.insert(c);
}
bool res = true;
for(char c:s1){
if(set2.count(c) == 0){
res = false;
break;
}
}
if(res){
cout << "true"<< endl;
}else{
cout << "false" <<endl;
}
}
return 0;
}