strings anagrams(HELP)(Emergency)

ANYONE KNOW HOW TO WRITE THIS CODE?

Two strings are anagrams of each other if one can be formed by rearranging the
letters of the other (excluding spaces). For example, silent is an anagram of
listen , and anagrams is an anagram of ars magna .
In 2.cpp , write a C++ program that reads in two strings s and t , and finds the
positions of all anagrams of the second string t in the first string s .
For the input, you may assume that:
both input strings are not empty
the first string s contains letters in lower case and possibly some spaces in
between the letters; however, s does not have any leading or trailing spaces
the second string t contains lower case letters only and does not contain any
spaces
For the output:
each line should contain two numbers i j , so that the substring s[i]..s[j]
of s is an anagram of t . Note that while the substring s[i]..s[j] may
contain spaces in between the letters, it should not contain any leading or trailing
spaces
the output should be sorted by the starting position i of the identified anagram
s[i]..s[j]


Expected Output

2_1
dirty room
dormitory
0 9

2_2
anagram fun
farm
4 8

2_3
program fun
gun


2_4
washes
cashews


2_5
abade abc
dea
2 4
3 6


2_6
aa aaa a aa
aaaa
0 4
1 5
3 7
4 9
5 10


2_7
aa aa aaa a aa
aaaa
0 5
1 8
4 9
5 10
8 12
9 14
10 15


ANYONE KNOW HOW TO WRITE THIS CODE?
Have you tried yourself already? If so, post your code and point out where you think the problem is. If not, try it yourself and only when you're stuck, ask for help.
Topic archived. No new replies allowed.